使得Android的ListView的布局滚动 [英] Making android listview layout scrollable

查看:147
本文介绍了使得Android的ListView的布局滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在ASCII码的形式布局的XML文件:

I have an xml file that has the layout in ASCII form:

---------------
| ImageView
--------------
| TextView
--------------
| List...
--------------

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/com.some.app"
 android:orientation="vertical" android:layout_width="fill_parent"
 android:layout_height="fill_parent">
<ImageView 
android:id="@+id/MovieCover"
android:layout_width="100dip"
android:layout_height="100dip"
/> 
 <TextView
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:textSize="16sp"
    android:padding="10dp"
    android:id="@+id/TextHeader"
    android:background="#000000">
</TextView>
<ListView android:id="@+id/ListView02" android:layout_height="wrap_content"
 android:layout_width="fill_parent">
 </ListView>
 </LinearLayout>

我在展示布局时我的ImageView和TextView中占据了超过3/4屏幕的问题。如何让我的ImageView和TextView的滚动与正在显示的ListView?在这个时间点上,仅在ListView要滚动,我想,尽管它们是在它自己的一个页面的整个布局是滚动的。

I'm having a problem displaying the layout when my ImageView and TextView takes up more than 3/4 of the screen. How do I make ImageView and TextView scrollable with the ListView that is being displayed? At this point of time, only the ListView to be scrolled and I want the entire layout to be scrollable as though they are one page on its own.

我怎么能这样做?

推荐答案

您可以使用&LT;&滚动型GT; 为您的布局容器

You can use <ScrollView> as your layout container

沿着线的东西。

<ScrollView>
    <LinearLayout>
    // your layout here
    </LinearLayout>
</ScrollView>

为什么我们需要的LinearLayout的原因里面是滚动型只能有一个直接子

the reason why we need the LinearLayout inside is that ScrollView can only have one direct child

这篇关于使得Android的ListView的布局滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆