LinearLayout、RelativeLayout、FrameLayout内容居中显示
2015-09-29 21:08 魔术G 阅读(733) 评论(0) 编辑 收藏 举报转自http://hnlixf.iteye.com/blog/1887312
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/icon" /> </LinearLayout> <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/icon" android:layout_gravity="center" /> </FrameLayout> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/icon" android:layout_centerInParent="true" /> </RelativeLayout> </LinearLayout>