开始傻乎乎的用LinearLayout用了半天,后来发现要用RelativeLaout,并要在要居右的TextView中添加
android:layout_alignParentRight="true"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView1"
android:textSize="16sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView2"
android:textSize="16sp"
android:layout_alignParentRight="true"/>
</RelativeLayout>
如此,即可实现两个View,一个居左一个居右