Java 网络视图&x2B;底部的admob+;线性布局
我无法在顶部带有Progressbar的LinearLayout中的webview的botton中正确发布admob。我尝试了很多方法,与亲戚一起,在Stackoverflow中搜索并遵循一些步骤,但这个Progressbar不起作用Java 网络视图&x2B;底部的admob+;线性布局,java,android,xml,layout,Java,Android,Xml,Layout,我无法在顶部带有Progressbar的LinearLayout中的webview的botton中正确发布admob。我尝试了很多方法,与亲戚一起,在Stackoverflow中搜索并遵循一些步骤,但这个Progressbar不起作用 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/ProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="false"
android:maxHeight="10dip"
android:minHeight="10dip"
android:progress="50"
android:progressDrawable="@drawable/greenprogress" />
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-7041222655570180/1503313077"
ads:loadAdOnCreate="true"
ads:refreshInterval="30" >
</com.google.ads.AdView>
</LinearLayout>
您发布的布局无法工作,因为您的内部线性布局的高度为
wrap\u content
(从而导致忽略其子级的布局权重),但web视图的高度为0。您还为您的广告视图设置了1的权重,似乎它应该尽可能多地占据空间,而通常广告应该具有固定的高度
我不知道为什么RelativeLayout对您不起作用,但可能您正试图将它与布局重量
一起使用?如果是,请注意layout\u weight
仅适用于线性布局的子项
我会这样做:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="false"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-7041222655570180/1503313077"
ads:loadAdOnCreate="true"
ads:refreshInterval="30" >
</com.google.ads.AdView>
<LinearLayout
android:layout_alignParentTop="true"
android:layout_above="@id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/ProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:indeterminate="false"
android:progress="50"
android:progressDrawable="@drawable/greenprogress" />
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</RelativeLayout>
您发布的布局无法工作,因为您的内部线性布局的高度为wrap\u content
(从而导致忽略其子级的布局权重),但web视图的高度为0。您还为您的广告视图设置了1的权重,似乎它应该尽可能多地占据空间,而通常广告应该具有固定的高度
我不知道为什么RelativeLayout对您不起作用,但可能您正试图将它与布局重量
一起使用?如果是,请注意layout\u weight
仅适用于线性布局的子项
我会这样做:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="false"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-7041222655570180/1503313077"
ads:loadAdOnCreate="true"
ads:refreshInterval="30" >
</com.google.ads.AdView>
<LinearLayout
android:layout_alignParentTop="true"
android:layout_above="@id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/ProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:indeterminate="false"
android:progress="50"
android:progressDrawable="@drawable/greenprogress" />
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</RelativeLayout>
您发布的布局无法工作,因为您的内部线性布局的高度为wrap\u content
(从而导致忽略其子级的布局权重),但web视图的高度为0。您还为您的广告视图设置了1的权重,似乎它应该尽可能多地占据空间,而通常广告应该具有固定的高度
我不知道为什么RelativeLayout对您不起作用,但可能您正试图将它与布局重量
一起使用?如果是,请注意layout\u weight
仅适用于线性布局的子项
我会这样做:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="false"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-7041222655570180/1503313077"
ads:loadAdOnCreate="true"
ads:refreshInterval="30" >
</com.google.ads.AdView>
<LinearLayout
android:layout_alignParentTop="true"
android:layout_above="@id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/ProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:indeterminate="false"
android:progress="50"
android:progressDrawable="@drawable/greenprogress" />
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</RelativeLayout>
您发布的布局无法工作,因为您的内部线性布局的高度为wrap\u content
(从而导致忽略其子级的布局权重),但web视图的高度为0。您还为您的广告视图设置了1的权重,似乎它应该尽可能多地占据空间,而通常广告应该具有固定的高度
我不知道为什么RelativeLayout对您不起作用,但可能您正试图将它与布局重量
一起使用?如果是,请注意layout\u weight
仅适用于线性布局的子项
我会这样做:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="false"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-7041222655570180/1503313077"
ads:loadAdOnCreate="true"
ads:refreshInterval="30" >
</com.google.ads.AdView>
<LinearLayout
android:layout_alignParentTop="true"
android:layout_above="@id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/ProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:indeterminate="false"
android:progress="50"
android:progressDrawable="@drawable/greenprogress" />
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</RelativeLayout>
对我来说也很有魅力。我向你致敬。我有一个关于使用片段来显示广告的问题。()。如果没有互联网连接,内容是否会延伸并填满屏幕?我不知道答案,但你可以很容易地通过这样做找到答案。这对我来说也很有吸引力。我向你致敬。我有一个关于使用片段来显示广告的问题。()。如果没有互联网连接,内容是否会延伸并填满屏幕?我不知道答案,但你可以很容易地通过这样做找到答案。这对我来说也很有吸引力。我向你致敬。我有一个关于使用片段来显示广告的问题。()。如果没有互联网连接,内容是否会延伸并填满屏幕?我不知道答案,但你可以很容易地通过这样做找到答案。这对我来说也很有吸引力。我向你致敬。我有一个关于使用片段来显示广告的问题。()。如果没有互联网连接,内容是否会延伸并填满屏幕?我不知道答案,但你可以通过这样做很容易找到答案。