2
我有一个FrameLayout其中有一个ScrollView作为唯一的孩子。在运行期间,我膨胀一个RelativeLayout其中有一个ScrollView并将其添加到FrameLayout(此子视图现在重叠以前的ScrollView)。我已经使用LockableScrollView作为FrameLayout的第一个孩子,所以我可以通过将可滚动属性设置为false来禁用它的滚动,在将新孩子添加到FrameLayout之后,可聚焦和可点击的属性也设置为false。但仍然无法滚动新的ScrollView。任何指针?无法滚动2 FrameLayout上的ScrollViews
以下是根布局。
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/frame"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:id="@+id/relative_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/questions_bg">
<ImageView
android:id="@+id/questions_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:scaleType="fitXY"
android:src="@drawable/header_bg" />
<com.package.ui.LockableScrollView
android:id="@+id/question_scrollview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/questions_header"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarStyle="insideOverlay"
android:scrollbarFadeDuration="0"
android:fillViewport="true">
<!-- Some more views -->
</com.package.ui.LockableScrollView>
</RelativeLayout>
</FrameLayout>
以下是在运行时充气并添加到FrameLayout的子布局。
<?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="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="20dp">
<ImageView
android:id="@+id/q_map_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:src="@drawable/en_question_map_header" />
<ImageView
android:id="@+id/q_map_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/q_map_header"
android:src="@drawable/question_map_content" />
<ImageView
android:id="@+id/q_map_footer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/q_map_bg"
android:paddingBottom="50dp"
android:src="@drawable/en_question_map_footer" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/q_map_header"
android:layout_above="@id/q_map_footer"
android:layout_marginLeft="28dp"
android:layout_marginRight="30dp"
android:layout_marginTop="14dp"
android:layout_marginBottom="14dp"
android:layout_alignLeft="@id/q_map_header"
android:layout_alignRight="@id/q_map_header"
android:fillViewport="true" >
<GridView
android:id="@+id/q_map_grid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="5"
android:verticalSpacing="8dp"
android:horizontalSpacing="8dp"
android:stretchMode="columnWidth"
android:gravity="center_horizontal" />
</ScrollView>
</RelativeLayout>
Hu Raghnath,你可以发布您的代码 – 2011-05-31 05:10:30
@Deepak,希望这有助于。 – 2011-05-31 05:54:18