2

我已经在调试器中针对许多不同大小测试了我的应用程序,并意识到我可能需要一个 scrollView 来允许用户查看完整的布局。

问题是我在 main.xml 中使用了具有多个线性布局的鳍状肢,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<ViewFlipper
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/your_flipper"
    android:screenOrientation="portrait"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     <!-- the second view on the flipper -->
    <!-- ImageView -->
    <!-- TextViews -->
    <!-- Buttons -->
    <!-- Image Buttons -->


</LinearLayout>

<!-- the 3rd view on the flipper -->
<!-- ImageView -->
<!-- TextViews -->
<!-- Buttons -->
<!-- Image Buttons -->


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

</LinearLayout>

<!-- the 4th view on the flipper -->
<!-- ImageView -->
<!-- TextViews -->
<!-- Buttons -->
<!-- Image Buttons -->


</LinearLayout>

我制作了 ImageViews、Buttons、TextViews 等注释,以免使代码臃肿 -

这是在我的主 xml 文件中,其中显示了所有布局。我怎样才能轻松地为每个布局添加一个滚动视图,所以如果它对于某个手机的屏幕来说太大了,用户可以滚动浏览页面以查看所有内容?

谢谢!

4

2 回答 2

3

我建议用自己LinearLayout的. 虽然您可以包装整个,但如果您不希望滚动一个视图,则将来无法修改。ViewFlipperScrollViewViewFlipper

于 2010-11-23T04:04:41.970 回答
1

您必须包装布局(主要的线性布局或您创建为容器的东西)

带有「scrollView」,

像这样 :

http://www.androidpeople.com/android-scrollview-example/

于 2010-11-23T03:55:43.897 回答