我想让屏幕可滚动这是我的全屏
我想在此下面进行筛选:
滚动我将如何做到这一点?在我的代码中listview scrolable并非所有ui scrool我想在三个标签“午餐”早餐下制作可滚动“和Suppper帮助我
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/editbackground" >
<ImageButton
android:id="@+id/btnback"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="@android:color/transparent"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:src="@drawable/myback" />
<TextView
android:id="@+id/txtCaption2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/btnback"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingTop="10dp"
android:text="Menues"
android:textSize="17dp" >
</TextView>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/border"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100" >
<ImageView
android:id="@+id/imgfourth1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="33"
android:paddingTop="2dp"
android:src="@drawable/amlet1" />
<ImageView
android:id="@+id/imgfourth2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="33"
android:paddingTop="2dp"
android:src="@drawable/lnch1" />
<ImageView
android:id="@+id/imgfourth3"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="33"
android:paddingTop="2dp"
android:src="@drawable/supper" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="@drawable/border4"
android:orientation="horizontal"
android:weightSum="100" >
<TextView
android:id="@+id/txtfth1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="33"
android:gravity="center_horizontal"
android:text="Breakfast" />
<TextView
android:id="@+id/txtfth2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="33"
android:gravity="center_horizontal"
android:text="Lunch" />
<TextView
android:id="@+id/txtfth3"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="33"
android:gravity="center_horizontal"
android:text="Supper" />
</LinearLayout>
</LinearLayout>
<!-- i want screen below this line scrollable -->
<LinearLayout
android:id="@+id/buttonlayout"
android:layout_width="fill_parent"
android:layout_height="60sp"
android:background="#ffffff"
android:gravity="left|top"
android:height="60sp"
android:orientation="horizontal" >
<ImageView
android:id="@+id/last_month"
android:layout_width="20sp"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginLeft="10sp"
android:src="@drawable/calendar_left_arrow_selector" >
</ImageView>
<TextView
android:id="@+id/date_today"
android:layout_width="fill_parent"
android:layout_height="60sp"
android:layout_weight="0.6"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000" >
</TextView>
<ImageView
android:id="@+id/next_month"
android:layout_width="20sp"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginRight="10sp"
android:src="@drawable/calendar_right_arrow_selector" >
</ImageView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/last_week"
android:layout_width="50sp"
android:layout_height="fill_parent"
android:background="#F2F2F2"
android:src="@drawable/barrowleft2" >
</ImageView>
<TableLayout
android:id="@+id/table_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:stretchColumns="0,1,2,3,4,5,6" >
<TableRow
android:background="#F2F2F2"
android:paddingBottom="12dp" >
<!--
<TextView
android:id="@+id/sun"
android:gravity="center"
android:text="@string/sunday"
android:textColor="#000000"/>
-->
<TextView
android:id="@+id/mon"
android:gravity="center"
android:text="@string/monday"
android:textColor="#000000" />
<TextView
android:id="@+id/tue"
android:gravity="center"
android:text="@string/tuesday"
android:textColor="#000000" />
<TextView
android:id="@+id/wed"
android:gravity="center"
android:text="@string/wednesday"
android:textColor="#000000" />
<TextView
android:id="@+id/thur"
android:gravity="center"
android:text="@string/thursday"
android:textColor="#000000" />
<TextView
android:id="@+id/fri"
android:gravity="center"
android:text="@string/friday"
android:textColor="#000000" />
<!--
<TextView
android:id="@+id/sat"
android:gravity="center"
android:text="@string/saturday"
android:textColor="#000000"/>
-->
</TableRow>
<TableRow>
<!--
<Button
android:id="@+id/e00"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/calendar_button_selector"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#D9DBD7" >
</Button>
-->
<Button
android:id="@+id/e01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/calendar_button_selector"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#D9DBD7" >
</Button>
<Button
android:id="@+id/e02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/calendar_button_selector"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#D9DBD7" >
>
</Button>
<Button
android:id="@+id/e03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/calendar_button_selector"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#D9DBD7" >
>
</Button>
<Button
android:id="@+id/e04"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/calendar_button_selector"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#D9DBD7" >
>
</Button>
<Button
android:id="@+id/e05"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/calendar_button_selector"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#D9DBD7" >
>
</Button>
<!--
<Button
android:id="@+id/e06"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/calendar_button_selector"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#D9DBD7" > >
</Button>
-->
</TableRow>
</TableLayout>
<ImageView
android:id="@+id/next_week"
android:layout_width="50sp"
android:layout_height="fill_parent"
android:background="#F2F2F2"
android:src="@drawable/barrrow113" >
</ImageView>
</LinearLayout>
<LinearLayout
android:id="@+id/lytContent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/txtCopyright"
android:layout_below="@+id/lytTitlebar"
android:background="@drawable/border2"
android:orientation="vertical" >
<ListView
android:id="@+id/listfourthscrMenu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:dividerHeight="1dip"
android:fadeScrollbars="true"
android:listSelector="@drawable/listview_selector" />
</LinearLayout>
</LinearLayout>
答案 0 :(得分:1)
首先:你只需改变你的布局:(将你的布局转移到另一个文件xml)
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/editbackground" >
<ImageButton
android:id="@+id/btnback"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="@android:color/transparent"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:src="@drawable/myback" />
<TextView
android:id="@+id/txtCaption2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/btnback"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingTop="10dp"
android:text="Menues"
android:textSize="17dp" >
</TextView>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/border"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100" >
<ImageView
android:id="@+id/imgfourth1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="33"
android:paddingTop="2dp"
android:src="@drawable/amlet1" />
<ImageView
android:id="@+id/imgfourth2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="33"
android:paddingTop="2dp"
android:src="@drawable/lnch1" />
<ImageView
android:id="@+id/imgfourth3"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="33"
android:paddingTop="2dp"
android:src="@drawable/supper" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="@drawable/border4"
android:orientation="horizontal"
android:weightSum="100" >
<TextView
android:id="@+id/txtfth1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="33"
android:gravity="center_horizontal"
android:text="Breakfast" />
<TextView
android:id="@+id/txtfth2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="33"
android:gravity="center_horizontal"
android:text="Lunch" />
<TextView
android:id="@+id/txtfth3"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="33"
android:gravity="center_horizontal"
android:text="Supper" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/lytContent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/txtCopyright"
android:layout_below="@+id/lytTitlebar"
android:background="@drawable/border2"
android:orientation="vertical" >
<ListView
android:id="@+id/listfourthscrMenu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:dividerHeight="1dip"
android:fadeScrollbars="true"
android:listSelector="@drawable/listview_selector" />
</LinearLayout>
</LinearLayout>
创建一个新文件header.xml并粘贴您在上面剪切的所有内容。
在扩充布局时的代码中: ListView listView = findViewById(....); 您创建一个headerView:View headerView = LayoutInflater.from(context).inflate(R.layout.header,null); 然后是listView.addHeaderView(headerView);
当然在标题视图中的每个视图,如ImageView last_month,你可以通过lastMonthView = headerView.findViewById(....)进行搜索;
是否清楚?