我需要一些布局方面的帮助。我有一个带按钮的水平视图,另一个带有按钮的线性布局,然后是listview,然后是底部的AdView(AdMob)。我的问题是,底部的AdView覆盖了listview,我无法做到正确。请参阅我附带的代码。任何帮助将不胜感激。谢谢。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res/com.google.example"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/Lay1"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<HorizontalScrollView
android:scrollbars="none"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:gravity="center_vertical|center_horizontal"
android:layout_height="60px">
<Button android:id="@+id/SCHButton_1"
style="@style/RSSButtonText"
android:background="@layout/rssbuttonshape"/>
<Button android:id="@+id/SCHButton_2"
style="@style/RSSButtonText"
android:background="@android:color/transparent"/>
<Button android:id="@+id/SCHButton_3"
style="@style/RSSButtonText"
android:background="@android:color/transparent"/>
<Button android:id="@+id/SCHButton_4"
style="@style/RSSButtonText"
android:background="@android:color/transparent"/>
<Button android:id="@+id/SCHButton_5"
style="@style/RSSButtonText"
android:background="@android:color/transparent"/>
<Button android:id="@+id/SCHButton_6"
style="@style/RSSButtonText"
android:background="@android:color/transparent"/>
<Button android:id="@+id/SCHButton_7"
style="@style/RSSButtonText"
android:background="@android:color/transparent"/>
</LinearLayout>
</HorizontalScrollView>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<Button android:id="@+id/SCHButton_11"
android:text="Button11"
android:background="@drawable/button_no"
android:layout_width="120px"
style="@style/ButtonText2">
</Button>
<Button android:id="@+id/SCHButton_12"
android:text="Button12"
android:background="@drawable/button_no"
android:layout_width="120px"
style="@style/ButtonText2">
</Button>
<Button android:id="@+id/SCHButton_13"
android:text="Button13"
android:background="@drawable/button_no"
android:layout_width="120px"
style="@style/ButtonText2">
</Button>
<Button android:id="@+id/SCHButton_14"
android:text="Button14"
android:background="@drawable/button_no"
android:layout_width="120px"
style="@style/ButtonText2">
</Button>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ListView android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:cacheColorHint="#00000000"
android:listSelector="@drawable/list_selector"
android:drawSelectorOnTop="false">
</ListView>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_alignBottom="@+id/Lay1">
</LinearLayout>
</RelativeLayout>
答案 0 :(得分:0)
试试这个:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res/com.google.example"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:id="@+id/adView"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:gravity="bottom" android:layout_alignParentBottom="true"
/>
<LinearLayout android:id="@+id/Lay1" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@+id/adview">
<HorizontalScrollView android:scrollbars="none"
android:layout_height="wrap_content" android:layout_width="fill_parent">
<LinearLayout android:layout_width="fill_parent"
android:gravity="center_vertical|center_horizontal"
android:layout_height="60px">
<Button android:id="@+id/SCHButton_1" style="@style/RSSButtonText"
android:background="@layout/rssbuttonshape" />
<Button android:id="@+id/SCHButton_2" style="@style/RSSButtonText"
android:background="@android:color/transparent" />
<Button android:id="@+id/SCHButton_3" style="@style/RSSButtonText"
android:background="@android:color/transparent" />
<Button android:id="@+id/SCHButton_4" style="@style/RSSButtonText"
android:background="@android:color/transparent" />
<Button android:id="@+id/SCHButton_5" style="@style/RSSButtonText"
android:background="@android:color/transparent" />
<Button android:id="@+id/SCHButton_6" style="@style/RSSButtonText"
android:background="@android:color/transparent" />
<Button android:id="@+id/SCHButton_7" style="@style/RSSButtonText"
android:background="@android:color/transparent" />
</LinearLayout>
</HorizontalScrollView>
<LinearLayout android:layout_height="wrap_content"
android:layout_width="fill_parent">
<Button android:id="@+id/SCHButton_11" android:text="Button11"
android:background="@drawable/button_no" android:layout_width="120px"
style="@style/ButtonText2" />
<Button android:id="@+id/SCHButton_12" android:text="Button12"
android:background="@drawable/button_no" android:layout_width="120px"
style="@style/ButtonText2" />
<Button android:id="@+id/SCHButton_13" android:text="Button13"
android:background="@drawable/button_no" android:layout_width="120px"
style="@style/ButtonText2" />
<Button android:id="@+id/SCHButton_14" android:text="Button14"
android:background="@drawable/button_no" android:layout_width="120px"
style="@style/ButtonText2" />
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ListView android:id="@id/android:list"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:background="#FFFFFF" android:cacheColorHint="#00000000"
android:listSelector="@drawable/list_selector"
android:drawSelectorOnTop="false" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
答案 1 :(得分:0)
试试这个
<LinearLayout
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_below="@+id/Lay1">
</LinearLayout>