【问题标题】:Linear layout in Android always scrollableAndroid中的线性布局总是可滚动的
【发布时间】:2013-05-16 14:18:38
【问题描述】:

如何使垂直线性布局始终可滚动,即使我的布局中只有一个 TextView?

  • 当我向上滚动时,我希望它滚动并在底部显示一个空白区域。
  • 当我向下滚动时,我希望它在我的视图顶部显示一个空白。

这是我的代码:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ScrollView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
             android:id="@+id/addCategory"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="Scrollable view"/>
    </LinearLayout>
</ScrollView>

【问题讨论】:

标签: android layout scrollable


【解决方案1】:

你不能通过 android 提供的任何默认 API 来做到这一点,但是你正在寻找这个 -

Horizontal Pager.

这个问题已经在这里回答了 -

Android horizontal scrollview behave like iphone scroll

【讨论】:

    猜你喜欢
    • 2014-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多