您好,在我的应用程序中,我使用网格视图显示图像和文本,我在线性布局中使用了框架布局。 现在我想在列表视图上方,我想显示一些图像。 谁能帮帮我吗。
XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<com.agilerise.hotel.SquareImageView
android:id="@+id/picture"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:paddingTop="50dp"
android:paddingBottom="50dp"
/>
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_gravity="bottom"
android:textColor="@android:color/black"
/>
</FrameLayout>
<GridView
android:id="@+id/buttom"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:numColumns="3"
android:layout_weight="1">
</GridView>
</LinearLayout>
答案 0 :(得分:0)
在xml中添加列表视图
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.68" >
</ListView>
并创建item.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image"
android:layout_width="50dip"
android:layout_height="50dip"
android:src="@drawable/ic_avatar"
android:scaleType="centerCrop"/>
</LinearLayout>
然后你应该在你的活动类中使用ArrayAdapter来创建你的listview ...