Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 水平滚动条问题_Java_Android_Button_Scroll - Fatal编程技术网

Java 水平滚动条问题

Java 水平滚动条问题,java,android,button,scroll,Java,Android,Button,Scroll,不确定我对内置按钮的水平滚动条有什么问题,请原谅,但我是java和android的新手,错误是此水平滚动视图布局或其线性布局父项可能没有用处 <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tabHost" android:layout_width="fill_parent" android:layout_height="fill_parent"

不确定我对内置按钮的水平滚动条有什么问题,请原谅,但我是java和android的新手,错误是
此水平滚动视图布局或其线性布局父项可能没有用处

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tabHost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <LinearLayout
            android:id="@+id/Html"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:paddingTop="60dp" >

            <HorizontalScrollView
                android:id="@+id/horizontalScrollView1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/lesson1" />

                    <Button
                        android:id="@+id/button2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/lesson2" />

                    <Button
                        android:id="@+id/button3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/lesson3" />

                </LinearLayout>

            </HorizontalScrollView>

                </LinearLayout>


        <LinearLayout
            android:id="@+id/CSS"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:paddingTop="60dp" >
        </LinearLayout>

        <LinearLayout
            android:id="@+id/Javascript"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:paddingTop="60dp" >
        </LinearLayout>
    </FrameLayout>

</TabHost>

警告意味着您可以删除HorizontalScrollView或其“@+id/Html”线性布局父视图,而不会对布局造成重大损失。之所以发生这种情况,是因为HorizontalScrollView是“@+id/Html”线性布局的唯一子级


在我学会使用RelativeLayout之前,我经常这样嵌套线性布局。我建议您也要习惯它,这样处理布局要容易得多:

这只是意味着您不需要
LinearLayout
,因为
HorizontalScrollView
LinearLayout