这是我的完整代码。它工作正常,但问题是滚动视图不起作用,滚动时不显示最后3个按钮。如何滚动和查看最后3个按钮?如何使用滚动视图查看所有屏幕?
<?xml version="1.0" encoding="UTF-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/background"
android:orientation="vertical" >
<RelativeLayout
android:layout_height="wrap_content"
android:background="@drawable/titlebar_background"
android:layout_width="fill_parent">
<ImageView
android:id="@+id/test_button_image"
android:layout_width="wrap_content"
android:src="@drawable/icon"
android:layout_height="wrap_content"
android:layout_alignParentTop="true">
</ImageView>
<TextView
android:id="@+id/test_button_text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_alignTop="@+id/test_button_image"
android:layout_toRightOf="@+id/test_button_image"
android:textColor="#ffffff"
android:text="San Diego Unified">
</TextView>
<TextView
android:id="@+id/test_button_text1"
android:layout_width="wrap_content"
android:textColor="#ffffff"
android:text="SCHOOL DISTRICT"
android:layout_height="wrap_content"
android:layout_below="@+id/test_button_text2"
android:layout_alignLeft="@+id/test_button_text2">
</TextView>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="left|center_vertical"
android:singleLine="true"
android:textColor="#ffffff"
android:text="HEALTHY BODIES HEALTHY MINDS "
android:textSize="12sp" />
<ImageButton
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/facebook" />
<ImageButton
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/twitter"
android:text="Button Text" />
</LinearLayout>
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<EditText
android:id="@+id/EditText01"
android:layout_alignParentLeft="true"
android:layout_width="fill_parent"
android:background="#a8a8a8"
android:paddingTop="15dp"
android:hint="SEARCH SCHOOL BY NAME"
android:layout_toLeftOf="@+id/Button01"
android:layout_height="wrap_content">
</EditText>
<!--
<Button
android:id="@+id/Button01"
android:text="Press Here!"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_height="wrap_content">
</Button>
-->
<ImageButton
android:id="@+id/ImageButton01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@drawable/title_search"
/>
</RelativeLayout>
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<ImageView
android:id="@+id/test_button_image"
android:layout_width="wrap_content"
android:src="@drawable/icon"
android:layout_height="wrap_content"
android:layout_alignParentTop="true">
</ImageView>
<TextView
android:id="@+id/test_button_text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_alignTop="@+id/test_button_image"
android:layout_toRightOf="@+id/test_button_image"
android:textColor="#ffffff"
android:singleLine="false"
android:text="Our Mission is to nourish our students so they can be fueled and
ready to learn because we believe Healthy Bodies Mean Healthy Minds .our farm to
school and garden to school programs promote healthy eating habits">
</TextView>
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#000000"/>
<LinearLayout
android:id="@+id/lytContent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@+id/lytTitlebar"
android:layout_above="@+id/txtCopyright">
<TextView
android:id="@+id/txtCaption"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/caption"
android:textColor="@color/text"
android:textStyle="bold"
android:textSize="10sp"
android:text="SELECT A SCHOOL TO VIEW LUNCH OR BREAKFAST MENUS"
android:paddingLeft="10dp"
android:paddingTop="3dp"
android:paddingBottom="3dp"/>
<ListView
android:id="@+id/listMainMenu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fadeScrollbars="true"
android:divider="@color/background"
android:dividerHeight="1dip"/>
</LinearLayout>
<!--
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
-->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#a8a8a8"
android:orientation="horizontal" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:textSize="10dp"
android:layout_height="wrap_content"
android:text="FARM TO SCHOOL" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:textSize="10dp"
android:layout_height="wrap_content"
android:text="TAKE A SURVEY" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SHARE THIS APP"
android:textSize="10dp"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
答案 0 :(得分:0)
设置android:layout_marginBottom =&#34; 100dip&#34;你最后的布局