मैं निम्नलिखित लेआउट कैसे प्राप्त कर सकता हूं, टेक्स्टव्यू TextView
के साथ ellipsize अंत के साथ और wrap_content
और तुरंत टेक्स्ट व्यू के दाईं ओर देखें?एंड्रॉइड - दाएं संरेखित दृश्य के साथ इलिप्सिज़
|[TextView] [View] |
|[TextView TextView] [View] |
|[TextView TextView T...] [View]|
[संपादित करें]
निम्नलिखित TableLayout
सही व्यवहार देता है::
<TableLayout
android:id="@+id/upper_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/alert_button"
android:shrinkColumns="0"
android:stretchColumns="2" >
<TableRow>
<TextView
android:id="@+id/name_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:includeFontPadding="false"
android:lines="1"
android:paddingTop="2dp"
android:scrollHorizontally="true" />
<TextView
android:id="@+id/unread_count_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:gravity="center"
android:includeFontPadding="false"
android:paddingBottom="0dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp" />
</TableRow>
</TableLayout>
यहाँ कैसे लेआउट व्यवहार करना चाहिए के तीन उदाहरण, अलग TextView चौड़ाई के साथ कर रहे हैं TableLayout
3 कॉलम का उपयोग करता है, आखिरी हैक है: strechColumns
संपत्ति यह सभी उपलब्ध स्थान लेती है, इसलिए दूसरा TextView
हमेशा पहले के दाईं ओर है। shrinkColumns
संपत्ति के कारण पहले TextView
सही ढंग से इलिप्सिज़ करें।
हालांकि, मुझे यह प्राप्त करने के लिए TableLayout
का उपयोग करने का विचार पसंद नहीं है। क्या कोई बेहतर तरीका जानता है?
धन्यवाद
क्या यह एक सूची है या नहीं? – Yury
हां, यह एक पंक्ति लेआउट है। – gdelente