`
djun100
  • 浏览: 167699 次
  • 性别: Icon_minigender_1
  • 来自: 大连
文章分类
社区版块
存档分类
最新评论

LinearLayout、RelativeLayout、FrameLayout居中显示

 
阅读更多

LinearLayout、RelativeLayout、FrameLayout居中显示需要设置的属性不一样,今天总结下,方便以后使用~~

<?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>


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics