直播商城源码,加载网页、html文件显示加载进度
新建加载WebViewActivity
新建WebViewActivity加载网页html文件
class WebViewActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
}
页面xml文件activity_web_view如下:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<WebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="@null"
android:indeterminateOnly="false"
android:max="100"
app:layout_constraintTop_toTopOf="parent"
android:progressDrawable="@drawable/progress_bar_horizontal"/>
</androidx.constraintlayout.widget.ConstraintLayout>
进度条progress_bar_horizontal.xml样式如下:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@android:id/background"
android:drawable="@color/white"/>
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:angle="270"
android:centerColor="#00923F"
android:centerY="0.75"
android:endColor="#888C98"
android:startColor="#00923F" />
</shape>
</clip>
</item>
</layer-list>
以上就是直播商城源码,加载网页、html文件显示加载进度, 更多内容欢迎关注之后的文章
标签:layout,parent,html,源码,android,id,加载 From: https://www.cnblogs.com/yunbaomengnan/p/17528365.html