Android Layout 不会横向垂直滚动

标签 android android-layout scroll scrollview android-relativelayout

嗨 Stack Overflow 社区,

我希望您能帮助解决我遇到的 Android 布局问题。当我的 Activity 处于横向时,我似乎无法让我的 Activity 垂直滚动。

我有一个 scrollview parent 和一个 relativelayout child。在相对布局中,我有各种元素。纵向方向看起来不错,但在横向 ImageView 中,我缩小以适应屏幕中的所有内容,而我想要的是垂直滚动。

非常感谢任何帮助并继续编写代码!

-AmarettoSlim

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

关于Android Layout 不会横向垂直滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7465076/

相关文章:

android - Activity URL 回调在 4.0.3 ICS 中不起作用

android - Viewpager 的静态页眉和页脚

Android Circle Shape in 16 to 23 Android版本

javascript - 制作 "scrolling"菜单

html - 如何使站点垂直滚动和拖动?

java - 无法使用查询从解析数据库中检索字符串

java - android java同时从不同线程读/写textview

android - 膨胀类 android.support.design.widget.CoordinatorLayout 和 ClassNotFoundException : android. support.design.R$styleable 时出错

ScrollView 内的 Android WebView 仅滚动 ScrollView

android - 从调用返回时 ViewRootImpl 中的 NullPointerException(仅适用于 Samsung Touch)