我正在开发一个包含webview的应用程序。我有RelativeLayoutxml文件的根元素。的RelativeLayout已ProgressBar,SwipeRefreshLayout,WebView和AdView包含元素。默认情况下,的可见性ProgressBar设置为gone,它应该在加载网页时出现,并且再次不可见。但是,它没有显示任何时间。这是我的activity_web_view.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="net.softglobe.allmedia.Showsite"
android:orientation="vertical">
<ProgressBar
android:id="@+id/pb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/progressbar_states"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:visibility="gone"/>
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:configChanges="orientation|screenSize"/>
</android.support.v4.widget.SwipeRefreshLayout>
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
android:layout_alignBottom="@id/swiperefresh"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
</com.google.android.gms.ads.AdView>
我尝试使用LinearLayoutwithweight和weightsum属性,然后ProgressBar显示,但是AdView消失了。
拉风的咖菲猫
陪伴而非守候
相关分类