Android 安卓布局赢得';t以横向方向垂直滚动

Android 安卓布局赢得';t以横向方向垂直滚动,android,android-layout,scroll,scrollview,android-relativelayout,Android,Android Layout,Scroll,Scrollview,Android Relativelayout,Hi Stack Overflow社区 我希望你能帮助解决我遇到的安卓布局问题。当我的活动处于横向时,我似乎无法使其垂直滚动 我有一个scrollview家长和一个relativelayout孩子。在相对论中,我有各种各样的元素。纵向看起来不错,但在横向的imageview中,我缩小了以适应屏幕上的所有内容,verus有一个我想要的垂直滚动 非常感谢您的帮助,请继续 -苦杏仁 <?xml version="1.0" encoding="utf-8"?> <ScrollView

Hi Stack Overflow社区

我希望你能帮助解决我遇到的安卓布局问题。当我的活动处于横向时,我似乎无法使其垂直滚动

我有一个scrollview家长和一个relativelayout孩子。在相对论中,我有各种各样的元素。纵向看起来不错,但在横向的imageview中,我缩小了以适应屏幕上的所有内容,verus有一个我想要的垂直滚动

非常感谢您的帮助,请继续

-苦杏仁

<?xml version="1.0" encoding="utf-8"?>

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ScrollView"
    android:layout_height="fill_parent" android:layout_width="fill_parent" android:fillViewport="true" android:scrollbars="vertical">

    <RelativeLayout android:id="@+id/MainScreen" android:background="@color/appbackground" android:layout_width="fill_parent" android:layout_height="fill_parent" android:isScrollContainer="true" android:scrollbars="vertical" android:scrollbarStyle="insideOverlay">
        <Spinner android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignLeft="@+id/cspinner" android:layout_marginTop="48dp" android:id="@+id/pspinner" android:layout_above="@+id/buttonGo"></Spinner>
        <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/cspinner" android:layout_toLeftOf="@+id/cspinner" android:layout_marginRight="14dp" android:layout_marginTop="14dp" android:id="@+id/labelC" android:text="@string/lblC"></TextView>
        <ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/logo" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="14dp" android:id="@+id/bannerLogo"></ImageView>
        <TextView android:id="@+id/labelPrice" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/lblP" android:layout_alignTop="@+id/pspinner" android:layout_alignRight="@+id/labelC" android:layout_marginTop="16dp"></TextView>
        <Spinner android:layout_height="wrap_content" android:id="@+id/cspinner" android:layout_width="wrap_content" android:layout_above="@+id/labelP" android:layout_centerHorizontal="true"></Spinner>
        <ImageView android:layout_height="wrap_content" android:id="@+id/imgHat" android:layout_width="wrap_content" android:src="@drawable/bowlericon" android:layout_centerHorizontal="true" android:layout_below="@+id/bannerLogo" android:layout_above="@+id/cspinner"></ImageView>
        <Button android:id="@+id/buttonGo" android:layout_width="fill_parent" android:text="@string/btnRun" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true"></Button>
    </RelativeLayout>

</ScrollView>

尝试为横向模式创建单独的布局,并将其放入

res/layout-land/

嗯。。。你给出了一个重要的线索:“在风景中,一切都会缩小以适应环境”。如果一切都合适,这是正常的没有卷轴

因此,我建议将相对长度高度改为“包裹内容”,而不是“填充父项”。这样,如果relativelayout中的内容超过scrollview高度,则可以滚动

顺便说一句,此外,填充父对象现在已过时。您应该使用“匹配父项”来代替