如何在使用android时滚动列表:background ="@ drawable/view1"

Sta*_*Fox 1 android android-listview

我有多少物品Listview,而且我已放置ImageButton在我的下方listview.

当我使用android:src ="@drawable/view1"获取所有项目并能够使用滚动.

但每当我用背景代替src时

android:background="@drawable/view1" 在图像按钮,滚动不起作用,为什么?

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#ffffff">

 <include
    android:id="@+id/header"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    layout="@layout/header"/>

<ListView android:layout_height="wrap_content"
    android:layout_weight="1" android:id="@+id/listView1"
    android:layout_width="fill_parent" 
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="20dp"
    android:cacheColorHint="#00000000"
    android:divider="#00000000"
    android:dividerHeight="20dp"/>


<ImageButton 
    android:layout_width="wrap_content" 
    android:id="@+id/ButtonViewCart"
    android:layout_height="wrap_content" 
    android:background="@drawable/view1"
    android:layout_margin="5dip"
    android:layout_gravity="right"/>

  </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

小智 5

ListViews默认是可滚动的.如果ListView中的项目数超过了屏幕上可显示的数量,则会自动滚动.