【安卓】怎样将多个列表视图由上至下的靠在一起
问题描述:
如图,我在创建多个便签后,
这几个便签却是一个便签占据了一页,
下一个便签要往下拉才看的到:
这里是显示全部便签的xml文件
all_note.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/set"
android:orientation="vertical" >
<ImageView
android:id="@+id/backButton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:background="@drawable/press" />
<ListView
android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:drawSelectorOnTop="false" />
<TextView
android:id="@id/android:empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/remind" />
</LinearLayout>
notelist_item.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/set"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:padding="2dp"/>
<TextView
android:id="@+id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:color="#0000cc"/>
</LinearLayout>
是要在这两个中的哪个改变UI?要怎么改?
答
item的高度一般设置固定值,不然里面子view 一多,显得不整齐,
答
把notelist_item.xml中LinearLayout 的android:layout_height="match_parent"写成 android:layout_height="wrap_content" 应该就可以了
答
notelist_item 的最外层高度设置时为一个固定值试试?