码迷,mamicode.com
首页 > 移动开发 > 详细

Android利用reative_layout生成梅花界面

时间:2017-05-11 18:29:10      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:ntop   技术   textview   enter   中间   back   ast   XML   content   

XML代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    
    <!-- 定义该组件位于父容器中间 -->
	<TextView android:id="@+id/view01" 
	    android:layout_width="50dp"
	    android:layout_height="50dp"
	    android:background="@drawable/a"
	    android:layout_centerInParent="true"
	    />
	
	<!-- 定义该组件位于父容器上方 -->
	<TextView android:id="@+id/view02" 
	    android:layout_width="50dp"
	    android:layout_height="50dp"
	    android:background="@drawable/a"
	    android:layout_above="@id/view01"
	    android:layout_alignLeft="@id/view01"
	    />
	
	<!-- 定义该组件位于view01组件的下方 -->
	<TextView android:id="@+id/view03" 
	    android:layout_width="50dp"
	    android:layout_height="50dp"
	    android:background="@drawable/a"
	    android:layout_below="@id/view01"
	    android:layout_alignLeft="@id/view01"
	    />
	
	<!-- 定义该组件位于view01组件的左边 -->
	<TextView android:id="@+id/view04" 
	    android:layout_width="50dp"
	    android:layout_height="50dp"
	    android:background="@drawable/a"
	    android:layout_toLeftOf="@id/view01"
	    android:layout_alignTop="@id/view01"
	    />
	
	<!-- 该组件位于view01组件的右边 -->
	<TextView android:id="@+id/view05" 
	    android:layout_width="50dp"
	    android:layout_height="50dp"
	    android:background="@drawable/a"
	    android:layout_toRightOf="@id/view01"
	    android:layout_alignTop="@id/view01"
	    />
</RelativeLayout>

效果:

技术分享

技术分享

Android利用reative_layout生成梅花界面

标签:ntop   技术   textview   enter   中间   back   ast   XML   content   

原文地址:http://www.cnblogs.com/llguanli/p/6842041.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!