ListView中的Item相对布局设置控件大小

》 在item的layout文件中,用android:layout_height设置item的高度。软件运行,发现高度设置无效。

1.据了解,listview每行的高度是由 inflater填充布局中高度最大的那个控件来决定的。


    android_id=”@+id/rl_question”
    android_layout_width=”match_parent”
    android_layout_height=”match_parent”
    android_background=”@color/white_color” >
            android_layout_width=”wrap_content”
        android_layout_height=”wrap_content”
        android_layout_centerVertical=”true”
        android_orientation=”vertical” >
       
                    android_id=”@+id/tv_instruct”
            android_layout_width=”wrap_content”
            android_layout_height=”wrap_content”
            android_layout_marginBottom=”14dp”
            android_layout_marginLeft=”15dp”
            android_layout_marginRight=”50dp”
            android_layout_marginTop=”14dp”
            android_singleLine=”true”
            android_textColor=”@color/version_name_3c3f46″
            android_textSize=”15sp” />
   
            android_layout_width=”wrap_content”
        android_layout_height=”wrap_content”
        android_layout_alignParentRight=”true”
        android_layout_centerVertical=”true”
        android_layout_marginRight=”15dp”
        android_background=”@drawable/list_right_arrow”
        android_contentDescription=”@null” />

》 2.可以说试试在item的layout文件中,给item设定minHeight,即可。请如下黑色粗体所示:

xml version=”1.0″ encoding=”utf-8″LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”horizontal” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:minHeight=”100dp” > TextViewandroid:id=”@+id/textView01″android:layout_width=”fill_parent” android:layout_height=”fill_parent android:text=”@string/hello”/>LinearLayout>

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2016年6月21日
下一篇 2016年6月22日

相关推荐