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生成梅花界面的更多相关文章

  1. Android 利用Gson生成或解析json

    目前手机端和服务端数据交流格式一般是json,而谷歌提供了Gson来解析json.下载Gson:https://code.google.com/p/google-gson/ 下载的放在lib并导入,若 ...

  2. android——利用SharedPreference做引导界面

    很久以前就接触过sharedPreference这个android中的存储介质.但是一直没有实际使用过,今天在看之前做的“民用机型大全”的app时,突然想到可以使用sharedPreference类来 ...

  3. Android利用zxing生成二维码

    感谢大佬:https://blog.csdn.net/mountain_hua/article/details/80646089 **gayhub上的zxing可用于生成二维码,识别二维码 gayhu ...

  4. linux(以ubuntu为例)下Android利用ant自动编译、修改配置文件、批量多渠道,打包生成apk文件

    原创,转载请注明:http://www.cnblogs.com/ycxyyzw/p/4555328.html  之前写过一篇<windows下Android利用ant自动编译.修改配置文件.批量 ...

  5. windows下Android利用ant自动编译、修改配置文件、批量多渠道,打包生成apk文件

    原创文章,转载请注明:http://www.cnblogs.com/ycxyyzw/p/4535459.html android 程序打包成apk,如果在是命令行方式,一般都要经过如下步骤: 1.用a ...

  6. Android 利用Application对象存取公共数据

    本文章来给大家介绍Android 利用Application对象存取公共数据. Android系统在运行每一个程序应用的时候,都会创建一个Application对象,用于存储与整个应用相关的公共变量. ...

  7. 利用Swashbuckle生成Web API Help Pages

    利用Swashbuckle生成Web API Help Pages 这系列文章是参考了.NET Core文档和源码,可能有人要问,直接看官方的英文文档不就可以了吗,为什么还要写这些文章呢? 原因如下: ...

  8. Android利用Http下载文件

    Android利用Http下载文件 一.场景 下载存文本文件和下载如mp3等大容量的文件 界面 二.代码编写 1.AndroidMainfest.xml中配置 主要是解决网络权限和写SDCard的权限 ...

  9. android利用zbar二维码扫描-(解决中文乱码及扫描区域定义)

    写在最前(这是对上一篇博文的问题做的更新[android利用zbar二维码扫描]) project下载   zbarLib编译project  project下载0积分 bug 在2.3的系统中Hol ...

随机推荐

  1. 【CF1068A】Birthday(签到)

    题意:有N种棋子,M个人,已有K种收藏,要求最小的每个人送的棋子数使得最坏情况下至少有L种新的收藏,无解输出-1 N,M,K,L<=1e18 思路: #include<cstdio> ...

  2. linux多线程学习笔记六--一次性初始化和线程私有数据【转】

    转自:http://blog.csdn.net/kkxgx/article/details/7513278 版权声明:本文为博主原创文章,未经博主允许不得转载. 一,一次性初始化 以保证线程在调用资源 ...

  3. C语言字符串操作总结大全(超详细)【转】

    转自:http://www.jb51.net/article/37410.htm )字符串操作 strcpy(p, p1) 复制字符串 strncpy(p, p1, n) 复制指定长度字符串 strc ...

  4. hdu 2807(矩阵+floyed)

    The Shortest Path Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  5. HDU 2034 人见人爱A-B【STL/set】

    人见人爱A-B Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Sub ...

  6. Codeforces 903F Clear The Matrix(状态压缩DP)

    题目链接 Clear The Matrix 题意 给定一个$4 * n$的矩形,里面的元素为$'.'$或$'*'$.现在有$4$种正方形可以覆盖掉$'*'$,正方形的边长分别为$1,2,3,4$. 求 ...

  7. Codeforces 583 DIV2 GCD Table 贪心

    原题链接:http://codeforces.com/problemset/problem/583/C 题意: 大概就是给你个gcd表,让你还原整个序列. 题解: 由$GCD(a,a)=a$,我们知道 ...

  8. Longest Valid Parentheses - LeetCode

    Given a string containing just the characters '(' and ')', find the length of the longest valid (wel ...

  9. eclipse 重构代码自动抽取函数

    1.选择重构代码段 2.重构 – 抽取方法 3.命名重构代码段抽取的方法 4.使用抽取的方法

  10. WinForm 读取Excel 数据显示到窗体中

    最近教学中,需要用到WinForm 读取Excel数据,于是就做了一个简单的,废话不多说,直接codding... //读取Excel的帮助类 class SqExcellHelper { publi ...