[英]How do I have my layout for the following
我有項目清單。 左邊的大盒子是我的照片。 這兩個框是文本框。 我希望上面的文本框被省略。 這是我當前的布局文件。
主布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp" >
<ListView
android:id="@+id/List"
android:layout_width="fill_parent"
android:clickable="true"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
每個列表項中的布局是
<?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="wrap_content"
android:padding="5dp" >
<ImageView
android:id="@+id/Logo"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:src="@drawable/ic_launcher" >
</ImageView>
<LinearLayout android:id="@+id/textViews"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:clickable="false"
android:focusableInTouchMode="false"
android:orientation="vertical">
<TextView
android:id="@+id/detail"
android:layout_width="match_parent"
android:ellipsize="end"
android:clickable="false"
android:focusableInTouchMode="false"
android:layout_height="wrap_content"
android:textSize="20sp" >
</TextView>
<TextView
android:id="@+id/detail2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="false"
android:focusableInTouchMode="false"
android:textSize="12sp" >
</TextView>
</LinearLayout>
</LinearLayout>
這樣,如果我在上方方框中的詳細信息太大,則...
之前需要兩行,並且永遠不會顯示下面的textView。
如果上方方框中的文字很小,則看起來不錯。 如何將上框的溢出限制為整個列表元素的大小?
謝謝
我認為您想將android:singleLine="true"
到上方的框中。
您可以給他們一個權重並將其高度設置為match_parent。
<TextView
android:id="@+id/detail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:ellipsize="end"
android:layout_weight="1"
android:focusableInTouchMode="false"
android:textSize="20sp" >
</TextView>
<TextView
android:id="@+id/detail2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:layout_weight="1"
android:focusableInTouchMode="false"
android:textSize="12sp" >
</TextView>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.