- 将activity_fo.xml中的TextView替换为WebView组件 - 在XWebViewActivity中添加content参数用于传递HTML内容 - 实现当URL为空时通过loadData方法加载HTML内容的功能 - 添加startWebNoTopBarForContent方法支持无顶部栏的内容展示 - 设置WebView背景色为黑色以匹配应用主题 - 添加ToolsHelper工具类用于判断URL是否为空
29 行
1.1 KiB
XML
29 行
1.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
xmlns:tools="http://schemas.android.com/tools"
|
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
|
|
|
<androidx.constraintlayout.widget.ConstraintLayout
|
|
android:layout_width="match_parent"
|
|
android:background="@color/app_color_black"
|
|
android:layout_height="match_parent"
|
|
tools:context=".web.XWebViewActivity">
|
|
|
|
<ProgressBar
|
|
android:id="@+id/X_progressBar"
|
|
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:max="100"
|
|
app:layout_constraintTop_toTopOf="parent" />
|
|
|
|
<WebView
|
|
android:id="@+id/X_webView"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="0dp"
|
|
android:background="@color/app_color_black"
|
|
app:layout_constraintTop_toBottomOf="@id/X_progressBar"
|
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
|
|
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
</layout> |