使用相对布局实现梅花图案的实例
使用相对布局实现梅花图案的实例
最新推荐文章于 2021-05-27 00:19:11 发布

皮皮虾sunny 于 2011-12-09 16:17:54 发布
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
各视图组件按照相互之间的相对位置确定,表示将标签中的元素放置到指定元素的下面是:
Android:layout_below=“@id/text”;将该元素放置在text元素下
Android:layout_ablove=“@id/text”; 将该元素放置在text元素上
Android:layout_toLeftOf=“@id/text”; 将该元素放置在text元素左面
Android:layout_alignTop=“@id/text”; 将该元素与text元素上部对齐
string.xml文件信息:
<string name="b00">根</string>
<string name="b11">茎</string>
<string name="b22">花</string>
<string name="b33">皮</string>
<string name="b44">叶</string>
Main.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">
<Button
android:id="@+id/no.0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/b00"/>
<Button
android:id="@+id/no.1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/no.0"
android:layout_toLeftOf="@id/no.0"
android:text="@string/b11"/>
<Button
android:id="@+id/no.2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/no.0"
android:layout_toRightOf="@id/no.0"
android:text="@string/b22"/>
<Button
android:id="@+id/no.3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/no.0"
android:layout_toLeftOf="@id/no.0"
android:text="@string/b33"/>
<Button
android:id="@+id/no.4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/no.0"
android:layout_toRightOf="@id/no.0"
android:text="@string/b44"/>
</RelativeLayout>
显示效果图:

整体思路:
首先在string.xml中定义文本的值,然后在main.xml中,定义整体布局,首先使用<RelativeLayout>标签定义中间位置,然后以它的位置为中心,定义其他四个按钮位置
相关知识
仙人掌盆栽UI布局,CSS3特效实例展示
简单梅花图案
Python编程实现花卉图案绘制与色彩搭配技巧详解
梅花图案图片
梅花易数的实例详解(原创)
Python类的实例化应用实现输入打印
梅花花瓣图案图片
城市道路绿地景观设计实例分析1.pptx
梅花刺绣图案
基础技法:画梅花时的布局
原文链接: 使用相对布局实现梅花图案的实例 https://m.huajiangbk.com/newsview1966341.html
| 上一篇: PS怎么将梅花图做成水墨画效果? | 下一篇: ai怎么画可爱的梅花? ai设计... |



