而不是margin-left(屏幕左边) 40dp这样的绝对数值?如果可能,请问分怎么做?
------解决方案--------------------
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
/>
<TextView android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="3"
/>
</LinearLayout>
------解决方案--------------------
方法很简单,在空白的地方放个不可见的控件,然后与TextView都设成 0dp 宽,weight 分别设成 1 和 3,当然是要放在 Linearlayout 中了。
------解决方案--------------------
用代码动态处理
------解决方案--------------------
一楼和三楼说的是同一种方法,楼主可以试下,动态写代码 会麻烦点
------解决方案--------------------
动态写代码要对layoutparam做处理,相对麻烦。