人类科技的进步源自探索,探索来自于发现本原,当然App布局没这么先进,本文是Android开发人员的必备知识,是我特别为大家整理和总结的,不求完美,但是有用。
Android界面开发多多少少会有很多雷同或者相似的布局,不仅如此,纵观Android应用的界面,总也逃不出那些熟悉的结构。
今天,我根据经验,把我认为的常见的布局做一个分析,介绍一种简单的模型,这个模型一般是我认为解决其对应布局问题的最佳布局,具体要看情况。下面是这个模型的学习。
还有一点我要强调,这些布局的原则就是:简单,灵活。
模型: 水平三列坐拥式
说明:水平三列,两边分别是"返回","提交"的按钮,中间是必须居中的几个字,一般都是标题名称。
仿佛标题内容的背景坐拥左右两位美女般的按钮。
方法:主要使用FrameLayout布局
layout代码:
<、!--这种布局:
缺点是,标题只能就几个字,字多了就会撑开并和两边的按钮重叠
优点是,代码简洁;--、>
<、?xml version="1.0" encoding="utf-8"?>
<、FrameLayout xmlns:android=""
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/layout01_bg"
android:paddingLeft="10dip"
android:paddingRight="10dip"
>
<、Button android:layout_gravity="left|center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/layout01_tool"
android:text="返回"
android:padding="8dip"
/>
<、TextView android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="标题内容"
android:textSize="18dip"
android:textColor="#000000" />
<、Button android:layout_gravity="right|center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/layout01_tool"
android:text="前进"
android:padding="8dip"
/>
<、/FrameLayout>
阅读(501) | 评论(0) | 转发(0) |