2
是否有人制造TextView width
匹配複合可繪製寬度(XML)?TextView寬度匹配drawableTop寬度
例如,對於XML代碼:
<TextView
android:id="@+id/textView"
style="@style/TextIcons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/icon_contact"
android:gravity="center"
android:lines="2"
android:text="@string/contact_label" />
我得到:
|---------------------|
| |-------------| |
| | | |
| | Drawable | |
| | View | |
| | | |
| |-------------| |
|[---Contact Label---]|
|---------------------|
但我真正想要的是:
|-----------------|
| |-------------| |
| | | |
| | Drawable | |
| | View | |
| | | |
| |-------------| |
| [---Contact---] |
| [----Label----] |
|-----------------|
它的工作原理,但實際上我得到了一致的兩條線左側,中間是必須的。 – GLopez
我明白了,在TextView中只添加android:gravity =「center」,謝謝。我寧願更簡單但看起來不是。 – GLopez