是否需要做任何事情来启用滚动视图内的滚动?另外,滚动视图中可以包含哪些元素?
这是相关的代码。第一个片段中的滚动视图似乎不起作用。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg_gray"
android:orientation="vertical" >
<include android:id="@+id/header"
android:layout_alignParentTop="true"
android:layout_width="wrap_content"
android:layout_height = "wrap_content"
layout="@layout/header_layout" />
<LinearLayout android:id="@+id/llFooter"
android:layout_width = "fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<Button android:id="@+id/datePick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:text="@string/confirmTime"
android:onClick="timeSelect" />
</LinearLayout>
<ScrollView android:id="@+id/calView"
android:layout_below="@id/header"
android:layout_above="@id/llFooter"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:fillViewport="true" >
<include android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/calendar_day_view" />
</ScrollView>
</RelativeLayout>
日历日视图:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:background="@android:color/white"
android:orientation="horizontal" >
<RelativeLayout android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/eightAM" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/nineAM"
android:translationY="60dp" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tenAM"
android:translationY="120dp" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/elevenAM"
android:translationY="180dp" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/twelvePM"
android:translationY="240dp" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/onePM"
android:translationY="300dp" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/twoPM"
android:translationY="360dp" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/threePM"
android:translationY="420dp" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fourPM"
android:translationY="480dp" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fivePM"
android:translationY="540dp" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sixPM"
android:translationY="600dp" />
</RelativeLayout>
<include android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="3"
layout="@layout/calendar_horizontal_delims" />"
</LinearLayout>
和 calendar_horizontal_delims.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<View android:translationY="60dip"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#000000"/>
<View android:translationY="120dip"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#000000"/>
<View android:translationY="180dip"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#000000"/>
<View android:translationY="240dip"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#000000"/>
<View android:translationY="300dip"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#000000"/>
<View android:translationY="360dip"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#000000"/>
<View android:translationY="420dip"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#000000"/>
<View android:translationY="480dip"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#000000"/>
<View android:translationY="540dip"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#000000"/>
<View android:translationY="600dip"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#000000"/>
</LinearLayout>