Android 横向视图问题(布局调试方法)

Android 横向视图问题(布局调试方法),android,android-layout,android-xml,Android,Android Layout,Android Xml,我想这是一个很烂的插件。当我在eclipse中切换到横向视图时,我得到如下结果: 当然,它不会让人想起典型的4英寸屏幕。所以没有办法检查ScrollView在eclipse中是如何工作的 好的,我将应用程序发送到手机。这里有个麻烦。当我将手机转向横向时,我得到了以下信息: 这是我能得到的最上面的卷轴。此图显示了可滚动区域: 这是我的xml代码。我会像往常一样尝试出错,但每次向手机发送一个应用程序都会让时间变得很长:/也许我可以在这里更快地获得帮助 在这种情况下(我在这里添加它作为一

我想这是一个很烂的插件。当我在eclipse中切换到横向视图时,我得到如下结果:

当然,它不会让人想起典型的4英寸屏幕。所以没有办法检查ScrollView在eclipse中是如何工作的

好的,我将应用程序发送到手机。这里有个麻烦。当我将手机转向横向时,我得到了以下信息:

这是我能得到的最上面的卷轴。此图显示了可滚动区域:

这是我的xml代码。我会像往常一样尝试出错,但每次向手机发送一个应用程序都会让时间变得很长:/也许我可以在这里更快地获得帮助



在这种情况下(我在这里添加它作为一个答案而不是一个注释),您必须为横向模式单独设计布局,并将这些布局放置在
res/layout land
中。但是请记住,布局的命名约定应该是相同的。例如:
setContentView(R.layout.main)默认情况下加载
纵向布局
。因此,当您打开手机并显示
横向布局
时,android将自动从您的
布局
文件夹中获取xml。所以,
setContentView(R.layout.main)这次从该文件夹加载xml。在设计布局本身时,应使图形编辑器以
横向
模式显示,以便于设计。试试这个

您是否为景观单独设计了此xml并将其放置在layout land文件夹中?是的,您可以像往常一样在eclipse中测试滚动——只需滚动即可。第一个图像链接不起作用…我没有单独设计。我不知道这件事。我没有任何东西可以滚动,正如第一张图片所示(我更正了链接)。很酷,但我仍然没有一个像样的景观布局预览。就像在第一个屏幕截图上一样:/Try Relative Layout。通常有帮助。还有一件事——在设计景观版本时,请记住设计方面。没错,我现在得到了正确的解决方案。好吧,仍然无法滚动,但它将尝试在滚动视图中嵌套整个内容。由于它是一个横向布局,我认为水平滚动视图会更好。
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center"
    android:layout_margin="30dip"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center" >

        <Button
            android:id="@+id/add_income"
            android:layout_width="120dip"
            android:layout_height="120dip"
            android:layout_margin="15dip"
            android:drawableTop="@drawable/icon_income"
            android:text="@string/income" >
        </Button>

        <Button
            android:id="@+id/add_expense"
            android:layout_width="120dip"
            android:layout_height="120dip"
            android:layout_margin="15dip"
            android:drawableTop="@drawable/icon_expense"
            android:text="@string/expense" >
        </Button>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center" >

        <Button
            android:id="@+id/categories"
            android:layout_width="120dip"
            android:layout_height="120dip"
            android:layout_margin="15dip"
            android:drawableTop="@drawable/icon_category"
            android:text="@string/categories" >
        </Button>

        <Button
            android:id="@+id/summary"
            android:layout_width="120dip"
            android:layout_height="120dip"
            android:layout_margin="15dip"
            android:drawableTop="@drawable/icon_summary"
            android:text="@string/summary" >
        </Button>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center" >

        <Button
            android:id="@+id/charts"
            android:layout_width="120dip"
            android:layout_height="120dip"
            android:layout_margin="15dip"
            android:drawableTop="@drawable/icon_charts"
            android:text="@string/charts" >
        </Button>

        <Button
            android:id="@+id/bug_list"
            android:layout_width="120dip"
            android:layout_height="120dip"
            android:layout_margin="15dip"
            android:drawableTop="@drawable/icon_bug"
            android:text="@string/bugs" >
        </Button>
    </LinearLayout>
</LinearLayout>