TextView中的文本需要右对齐,添加了android:gravity="right"后,发现在Graphical Layout中无法看到效果。
<TextView android:text="北京市" android:width="90dp"
android:textSize="20dp" android:gravity="right"
android:textColor="#ffffff" android:height="30dp"
android:layout_marginTop="150dp" android:id="@+id/city"
android:layout_marginLeft="200dp"
android:layout_width="wrap_content" android:layout_height="wrap_content"
></TextView>
后来折腾了好久,发现text为英文字符可以看到效果,在TextView的中文后面加了个空格后,在Graphical Layout中成功看到效果。
实际程序运行时不需要中文后面加空格的。