简体   繁体   English

水平滚动条问题

[英]horizontal scroll bar issues

not sure what issues i have with horizontal scroll bar with buttons inside please pardon me but i am brand new to java and android coding error is This HorizontalScrollView layout or its LinearLayout parent is possibly useless 不知道我在内部带有按钮的水平滚动条有什么问题,请原谅我,但是我是Java和android的新手,编码错误是This HorizontalScrollView layout or its LinearLayout parent is possibly useless

<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>

The warning means that you can remove either the HorizontalScrollView or its "@+id/Html" LinearLayout parent view with no signicant loss to your layout. 该警告表示您可以删除Horizo​​ntalScrollView或其“ @ + id / Html” LinearLayout父视图,而不会对布局造成任何重大损失。 It occurs because HorizontalScrollView is the only child of the "@+id/Html" LinearLayout. 发生这种情况是因为Horizo​​ntalScrollView是“ @ + id / Html” LinearLayout的唯一子级。

I used to nest LinearLayouts like this until I learned to use RelativeLayout. 在学习使用RelativeLayout之前,我曾经像这样嵌套LinearLines。 I recommend that you get used to it too, it is much easier to handle layouts that way: http://developer.android.com/guide/topics/ui/layout/relative.html 我建议您也熟悉它,以这种方式处理布局要容易得多: http : //developer.android.com/guide/topics/ui/layout/relative.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM