2012-01-09 30 views
0

我设计了我的布局,并在较小的手机屏幕上不是一切都可见,所以我想让它滚动,有人可以帮我解决这个问题吗?以下是我的布局的基本结构。试图让我的整个布局滚动

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/allowanceroot" 
    android:background="@drawable/background" 
    > 
    --TextView-- 
    --EditText-- 
    --TextView-- 
    --EditText-- 
    --TextView-- 
    --EditText-- 
</LinearLayout> 

难道我只是包含我TextViews和EditTexts在LinearLayout中,然后包含在一个滚动型?还有什么我需要做的编程?

回答

1

尝试它包裹在一个滚动视图

https://stackoverflow.com/a/4202608/661079

没有别的你需要做的

+0

好,谢谢,有用的例子,我得到了一些奇怪的错误之前。 – 2012-01-09 17:46:43

1

尝试这样

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

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/scroller" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     > 
     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 
      <TextView /> 
      <TextView /> 

     </LinearLayout> 
    </ScrollView>