Android FrameLayout而不是RelativeLayout
我有一个框架布局,底部有一个滚动视图和一个AdView横幅。 我认为有一种方法可以删除包含ScrollView和AdView的RelativeLayout,并保持UI现在的状态,但我不知道如何做到这一点Android FrameLayout而不是RelativeLayout,android,android-layout,android-fragments,Android,Android Layout,Android Fragments,我有一个框架布局,底部有一个滚动视图和一个AdView横幅。 我认为有一种方法可以删除包含ScrollView和AdView的RelativeLayout,并保持UI现在的状态,但我不知道如何做到这一点 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" xmlns:tools="http://s
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg"
tools:context="">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/adView"
android:layout_alignParentTop="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- A LOT of stuff -->
</RelativeLayout>
</ScrollView>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="" />
</RelativeLayout>
</FrameLayout>
试试这个:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</RelativeLayout>
</ScrollView>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
ads:adSize="BANNER"
ads:adUnitId="" />
</FrameLayout>
您可以删除FrameLayout或RelativeLayout。事实上,你应该考虑使用一个线性布局作为根元素。< /P>移除相对论并将FrAMLALayOUT转换成一个线性标签,使用一个带标签的UI,所以我需要FrAMLayayOUT作为根元素。那么您是如何创建选项卡的呢?是的,这样Adview始终可见…否则,如果您知道AdBar维度,只需为scrollView设置一个边距底部。。。