标签:android style blog color ar java sp on 2014
在LinearLayout中有个让元素居中的办法就是。比如在LinearLayout里有个TextView.设置TextView的gravity可以让其居中。
而在Realative里设置这个不起作用。困扰了我挺长时间。其实在Realative里有个替代的方法。就是设置子组件的android:layout_centerHorizontal="true"
就ok了。
如:
<RelativeLayout android:layout_width="match_parent" android:layout_height="200dp" android:id="@+id/cc_item_topLayout" > <ImageView android:layout_width="50dp" android:layout_height="50dp" android:id="@+id/cc_item_avatar" android:src="@drawable/touxiang" android:background="@drawable/btn_myborder" android:layout_marginTop="30dp" android:layout_centerHorizontal="true" /> </RelativeLayout>
标签:android style blog color ar java sp on 2014
原文地址:http://blog.csdn.net/howlaa/article/details/40507703