LinearLayout

android:orientation="vertical" #horizontalandroid:layout_gravity   #指定控件在布局中的对称方式#top、bottom、center_vertical、android:gravity              #指定文字在控件中的对齐方式android:layout_weight = 1#设置layout_weight的时候可以设置layout_width=0,系统会自己计算

RelativeLayout

#相对于父控件android:layout_alignParentLeft="true"android:layout_alignParentTop="true"android:layout_alignParentRight="true"android:layout_alignParentBottom="true"android:layout_centerInParent="true"#相对于兄弟控件,上、下、左、右android:layout_above="@id/..."android:layout_toRightOf = "@id/..."android:layout_toLeftOf = "@id/..."android:layout_below = "@id/..."#对齐属性android:layout_alignLeft="@id/.." #左对齐android:layout_alignRight="@id/..."#右对齐android:layout_alignTopandroid:layout_alignBottom

FrameLayout

都是位于控件的左上角

TableLayout

#一个TableRow内的内容在一行内#TableRow内的控件是不能指定宽度的android:layout_spam="2" #指定占用两列#设置TableLayout的android:stretchColumns="1",表示如果表格不能完全占满屏幕宽度,就将第二列拉伸#如果="0",代表拉伸第一列android:inputType="textPassword"
#引入布局#有一个布局文件title.xml

创建自定义控件

public class TitleLayout extends LinearLayout {  public TitleLayout(Context context, AttributeSet attrs) {    super(context, attrs);    layoutInflater.from(context).inflate(R.layout.title, this);    Button titleBack = (Button) findViewById(R.id.title_back);     title_back.setOnclickListener(new OnClickListener() {      @Override      public void onClick(View v) {        ((Activity) getContext()).finish();       }    })   }}
修改改为

更多相关文章

  1. Android(安卓)之shape
  2. android stylet
  3. Android仿iOS左右滑动开关控件(Android4.0以上适用)
  4. android使用RelativeLayout实现两端对齐
  5. android基础(一) View与六大布局(上)
  6. Android进入商店并跳转到指定应用
  7. Binary XML file line #4: tag requires a 'drawable' attribute
  8. 【063】◀▶ Android(安卓)(I) - 控件和布局
  9. Android(安卓)PopupWindow的使用

随机推荐

  1. Jquery隐藏()除一个类外所有具有特定类的
  2. 从一个页面上的AJAX帖子获得NTLM挑战
  3. 如何设置请求标头字符串[重复]
  4. jquery IE9没有错,IE8出错了
  5. php中的json对象未被读取
  6. Internet Explorer导致无效的真实性令牌
  7. Android+Jquery Mobile学习系列(6)-个人
  8. 将css添加到jquery数据表中的特定单元格
  9. 使用jQuery将行添加到表的tbody
  10. Jquery ready和window.onload方法区别