我刚开始编写日历。我没有制作表格布局或类似的东西,而是使用一堆子布局和视图创建了一个RelativeLayout。现在我遇到了问题,我无法在应用程序内水平滚动。垂直工作正常。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="800dp"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/relativeLayout0"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</RelativeLayout>
<ScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/relativeLayout0"
android:scrollbars="none">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:id="@+id/horizontalScrollView">
<RelativeLayout
android:id="@+id/relativeLayout242"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="20dp"
android:id="@+id/linearLayoutTest"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true">
</LinearLayout>
<View android:background="#aaa" android:layout_width = "fill_parent" android:layout_height="1dp" android:layout_marginTop="0dp"/>
<View android:background="#aaa" android:layout_width = "fill_parent" android:layout_height="1dp" android:layout_marginTop="40dp"/>
<View android:background="#aaa" android:layout_width = "fill_parent" android:layout_height="1dp" android:layout_marginTop="80dp"/>
</RelativeLayout>
</HorizontalScrollView>
</ScrollView>
</RelativeLayout>
还有一些其他布局,当然还有其他一些观点,但我认为你可以在这里看到问题。