如何讓文字居右對齊,換行後又居左對齊
效果圖
- 一般做出來的效果
- 預期效果圖(差別在第二張)
預期效果: 文字單行居右對齊,多行居左對齊.
實現方案
- 讓目標文字控制元件內居左對齊
- 在目標控制元件外圍套一層相對佈局,佔滿橫向空間,讓文字控制元件在相對佈局中居右顯示 .
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/selectAddressLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="分類"
android:textColor="#FF333333" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginStart="40dp"
android:text="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
android:textColor="#999999"
tools:ignore="SpUsage" />
</RelativeLayout>
</LinearLayout>
相關文章
- LI 標籤中讓文章標題左對齊,日期右對齊的方法
- UICollectionView左對齊流水佈局、右對齊流水佈局UIView
- iOS上如何讓按鈕文字左對齊問題iOS
- 如何讓文字垂直居中對齊文字框
- UIButton圖片文字控制元件位置自定義(圖片居右文字居左、圖片居中文字居中、圖片居左文字消失等)UI控制元件
- 如何讓input文字框和圖片對齊
- ·UILable屬性詳解,設定居上對齊,居中對齊,居下對齊,獲取斜體字,字型、大小、單位、顏色UI
- 文字對齊位置
- 文字如何做到垂直居中對齊
- css文字兩端對齊CSS
- canvas textAlign 文字對齊Canvas
- LinearLayout中元件右對齊元件
- CSS讓同一行文字和輸入框對齊CSS
- <摘錄>位元組對齊(強制對齊以及自然對齊)
- CAD表格文字對齊方式
- CSS文字水平居中對齊CSS
- CSS如何讓文字居於div的底部CSS
- css--實現一個文字少時居中,文字換行時居左的樣式CSS
- 【小技巧】CSS文字兩端對齊CSS
- Bootstrap系列 -- 5. 文字對齊方式boot
- 如何讓圖片在div中垂直水平居中對齊
- header問題:a中加上img後文字無法對齊Header
- 文字框與文字垂直對齊程式碼例項
- Bootstrap 4 實現導航欄右側對齊boot
- 對齊之美
- 位元組對齊
- Android Textview 一行居中 兩行居左AndroidTextView
- CSS文字框與驗證碼垂直對齊CSS
- 圖示文字水平對齊方法總結
- CSS 行內對齊的黑魔法CSS
- checkbox和後面文字無法居中對齊的解決方案
- PowerPoint如何對齊多個物件物件
- 實現文字標題和input文字框垂直居中對齊
- golang 位元組對齊Golang
- css居中對齊大全CSS
- android空格對齊Android
- [Shell] Sort 和 對齊
- 記憶體對齊記憶體