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. cf 512D - Fox And Travelling

    题目大意 给定一颗\(n\le 100\)个点的图,可以进行随机游走,求游走\(k=0...n\)个点的方案数 游走的规则是:每次只能访问一个度数\(\le 1\)的点,并将其删除 分析 看完傻眼 问 ...

  2. Dinic 网络流

    写个博客贴板子-- inline void add_edge(int x,int y,int z){ e[++tot].x=y,e[tot].cap=z; e[tot].next=h[x],h[x]= ...

  3. 洛谷 P1072 Hankson 的趣味题

    题目描述 Hanks 博士是 BT (Bio-Tech,生物技术) 领域的知名专家,他的儿子名叫 Hankson.现 在,刚刚放学回家的 Hankson 正在思考一个有趣的问题. 今天在课堂上,老师讲 ...

  4. 02深入理解C指针之---指针类型和值

    该系列文章源于<深入理解C指针>的阅读与理解,由于本人的见识和知识的欠缺可能有误,还望大家批评指教. 1.指针的类型: 可以在声明指针时,指定指针的类型,例如: (1)void *x  声 ...

  5. 属性动画详解一(Property Animation)

    效果图: Android动画有3类: 1.View Animation (Tween Animation) 2.Drawable Animation (Frame Animation) 2.Prope ...

  6. 初次使用git,记录使用步骤

      参考:https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 https://git ...

  7. Find Median from Data Stream - LeetCode

    Median is the middle value in an ordered integer list. If the size of the list is even, there is no ...

  8. CodeForces - 103D Time to Raid Cowavans

    Discription As you know, the most intelligent beings on the Earth are, of course, cows. This conclus ...

  9. 网络安全---大学霸_ITDaren

    http://blog.csdn.net/u014621518/article/category/2191665

  10. 标签页的切换方法(DOM)

    效果: 1.点击“JAVA语言” 2.点击“C语言” 3.点击C++语言 代码: <!doctype html> <html> <head> <meta ch ...