TextView
होने के कारण, इसकी चौड़ाई अपने माता-पिता की चौड़ाई के 1/3 से अधिक नहीं होनी चाहिए। यदि इसकी चौड़ाई माता-पिता के 1/3 से छोटी है, तो इसमें wrap_content
व्यवहार होना चाहिए। इसका क्षैतिज भाई हमेशा इसके आगे शुरू होगा।टेक्स्टव्यू चौड़ाई wrap_content को सेट करने के लिए कैसे करें लेकिन माता-पिता की चौड़ाई 1/12 तक सीमित करें
निम्नलिखित कोशिश की गई, यह हमेशा 1/3 और 2/3 का कड़ी कटौती है, इसलिए यदि टेक्स्ट 1 में 1/3 से कम स्थान है TextView
दो इसके आगे शुरू नहीं होंगे।
परिवर्तन LinearLayout
RelativeLayout
, तो android:layout_weight="n"
काम नहीं करता है मूल रूप से परिभाषित करने के लिए चौड़ाई wrap_content
है की जरूरत है और maxWidth
1/3 से अधिक नहीं है।
कोई सुझाव?
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="end"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:singleLine="true"
android:ellipsize="end"
android:layout_weight="2"
/>
</LinearLayout>
मैं यह हमेशा 1/3 लेकिन अधिकतम 1/3 होने के लिए नहीं करना चाहते, यह कम से कम 1/3 अनुमति देने के किया जाना चाहिए और भाई उसके बगल में बिना चाहिए अंतरिक्ष। – lannyf
अद्यतन उत्तर देखें ... –
धन्यवाद मार्क! यदि एक्सएमएल में प्राप्त नहीं हो सकता है तो आपका जवाब एक होगा। – lannyf