我有一個TextView。我想做所有的TextView(No.123 ... & Sea View ...)左對齊。我知道android:gravity="left"
android:layout_gravity="left"
但它不適合我的問題。如何對齊android中的所有TextView?
這是我的xml代碼;
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address " />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No.123, Blah Street, Blah Township, Blah Country" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Type "/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sea View, Graden View, Local" />
</LinearLayout>
</LinearLayout>
如何使用align left text view?如下圖所示。
輸出結果;
什麼是您的輸出?你能分享屏幕截圖嗎?並請更新代碼片段 –
中的LinearLayout的父佈局,以某種方式顯示您想要移動的內容以及以何種方式。不清楚。 –
見下文http://stackoverflow.com/a/42641608/3513479 沒有必要改變你的代碼只需把一條線 –