最後兩個按鈕,我在新的Android。我希望頁面的頂部有一個ImageView,頁面底部有4個按鈕,頁面中間有一個frameLayout。我已經完成了一個用於在FrameLayout中加載的xml文件。它包含ScrollView和10個按鈕。但是當我運行該程序時,最後兩個按鈕在滾動頁面後不會顯示在頁面上。不顯示了滾動型
任何人可以幫助我嗎?
的main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background">
<ImageView
android:id="@+id/yellowbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/smallyelowbar"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:layout_alignParentTop="true"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0"
android:layout_gravity="bottom"
android:layout_below="@id/yellowbar">
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"/>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/topmenu"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<Button android:id="@+id/btn1"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="@drawable/more_selector"/>
<Button
android:id="@+id/btn2"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="@drawable/contact_selector"/>
<Button android:id="@+id/btn3"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="@drawable/product_selector"/>
<Button android:id="@+id/btn4"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="@drawable/introduce_selector"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
scrooll.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/btn1_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="@drawable/product_sub_selector"
android:text="@string/btn1_product"
android:textColor="@color/white"
android:textSize="10sp"/>
<Button
android:id="@+id/btn2_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="@drawable/product_sub_selector"
android:textColor="@color/white"
android:text="@string/btn2_product"
android:layout_below="@id/btn1_product"
android:textSize="10sp"/>
<Button
android:id="@+id/btn3_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="@drawable/product_sub_selector"
android:textColor="@color/white"
android:text="@string/btn3_product"
android:layout_below="@id/btn2_product"
android:textSize="10sp"/>
<Button
android:id="@+id/btn4_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="@drawable/product_sub_selector"
android:textColor="@color/white"
android:text="@string/btn4_product"
android:layout_below="@id/btn3_product"
android:textSize="12sp"/>
<Button
android:id="@+id/btn5_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="@drawable/product_sub_selector"
android:textColor="@color/white"
android:text="@string/btn5_product"
android:layout_below="@id/btn4_product"
android:textSize="12sp"/>
<Button
android:id="@+id/btn6_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="@drawable/product_sub_selector"
android:textColor="@color/white"
android:text="@string/btn6_product"
android:layout_below="@id/btn5_product"
android:textSize="12sp"/>
<Button
android:id="@+id/btn7_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="@drawable/product_sub_selector"
android:textColor="@color/white"
android:text="@string/btn7_product"
android:layout_below="@id/btn6_product"
android:textSize="12sp"/>
<Button
android:id="@+id/btn8_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="@drawable/product_sub_selector"
android:textColor="@color/white"
android:text="@string/btn8_product"
android:layout_below="@id/btn7_product"
android:textSize="12sp"/>
<Button
android:id="@+id/btn9_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="@drawable/product_sub_selector"
android:textColor="@color/white"
android:text="@string/btn9_product"
android:layout_below="@id/btn8_product"
android:textSize="12sp"/>
<Button
android:id="@+id/btn10_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="@drawable/product_sub_selector"
android:textColor="@color/white"
android:text="@string/btn10_product"
android:layout_below="@id/btn9_product"
android:textSize="12sp"/>
</RelativeLayout>
</ScrollView>
</LinearLayout>
感謝您的幫助。
我不知道,但我想的LinearLayout應該是滾動型的內部。 ScrollView中的RelativeLayout不應該是必需的。 – Day
'RelativeLayout'是必需的,@Day。 'ScrollView'只能容納一個元素。 –
感謝快速reply.I刪除的LinearLayout但不顯示最後兩個按鈕。我想如果我將RelativeLaout更改爲LinearLayout,則不能解決問題。我認爲最後兩個按鈕隱藏了頁面底部的按鈕。 – SensorS