我有一個textview組件,我通過layout_weight將其寬度設置爲其父窗口的50%。我也需要爲它設置一個填充值。看來我可以將它設置爲xdp,但我如何使用weight config?比如說,左填充爲屏幕的2%?android:paddingLeft設置爲屏幕的百分比
<TextView
android:id="@+id/buttonCollect"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="@string/hello"
android:paddingLeft="8dp" //<---- how to se this.
android:layout_weight="0.5" />
謝謝。如果我想將寬度設置爲父級的90%,而高度爲父級的80%,則將其設置爲0dp。我應該如何設置layout_weight?因爲它似乎有一個layout_weight – Hammer