制作水平和垂直可滚动版面
问题描述:
我试图使水平和垂直ScrollableLayout
。我设法做出了水平或垂直可滚动的布局,但我无法在两面都做到这一点。制作水平和垂直可滚动版面
我试图把ScrollView
放在HorizontalScrollView
里面,但是当我这样做的时候它缩小了水平面。这里是我的代码:
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ScrollView
android:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ScrollView>
</HorizontalScrollView>
我正在用java代码在ScrollView
内添加我的视图。
答
这段代码实际上为我工作:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:id="@+id/verticalScroll"
android:layout_width="match_parent"
android:scrollbars="horizontal|vertical"
android:layout_height="match_parent"
android:fillViewport="true">
<HorizontalScrollView
android:id="@+id/mainLayout"
android:layout_width="wrap_content"
android:scrollbars="horizontal|vertical"
android:layout_height="wrap_content">
</HorizontalScrollView>
</ScrollView>
</LinearLayout>
看到这个[问题](https://*.com/questions/2044775/scrollview-vertical-and-horizontal-in-android) – FarshidABZ