zoukankan      html  css  js  c++  java
  • android 入门-布局

    android:gravity 针对本view 的位置。

    android:layout_gravity 本view相对于父布局view的位置。

    android:layout_alignParentRight 使当前控件与父布局右端对齐。

    android:layout_marginLeft="10dip" 使当前控件左边缘离上层布局的距离

    android:layout_alignParentLeft   使当前控件贴紧父元素的左边缘

    android:layout_toLeftOf="@id/ok" 使当前控件置于id 为ok的控件的左端

    android:layout_alignTop="@id/ok" 使当前控件置于id为ok的控件上端 对齐

    android:layout_centerInParent="true" 居中在父对象

    ================================================================

    =========================================================

    =========================================================

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="230dip"
        android:layout_height="wrap_content"
        android:background="@drawable/gray"
        android:gravity="center_vertical|center_horizontal"
        android:layout_gravity="center"
        android:orientation="vertical" >
    
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="30dip"
            android:paddingTop="10dip" >
    
            <ImageView
                android:id="@+id/dialog_title_image"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true" />
    
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:layout_marginLeft="10dip"
                android:layout_toRightOf="@id/dialog_title_image"
                android:text="Title"
                android:textColor="#000000"
                android:textSize="30sp" />
        </RelativeLayout>
    
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="1dip"
            android:layout_marginTop="1dip"
            android:background="@color/blue" />
    
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="10dip"
            android:paddingLeft="30dip"
            android:paddingRight="30dip"
            android:paddingTop="10dip"
            android:text="This is a custom dialog This is a custom dialogThis is a custom dialogThis is a custom dialogThis is a custom dialogThis is a custom dialogThis is a custom dialog"
            android:textColor="#000000" />
    
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="bottom|center_horizontal"
            android:paddingBottom="10dip"
            android:paddingTop="10dip" >
    
            <Button
                android:id="@+id/dialog_button_cancel"
                android:layout_width="100dip"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:text="确定" />
    
            <Button
                android:id="@+id/dialog_button_ok"
                android:layout_width="100dip"
                android:layout_height="wrap_content"
                android:layout_marginLeft="35dip"
                android:layout_toRightOf="@id/dialog_button_cancel"
                android:text="取消" />
        </RelativeLayout>
    
    </LinearLayout>

     http://blog.csdn.net/yuejingjiahong/article/details/6672707

  • 相关阅读:
    Pull Request
    选择器
    常见HTTP状态码
    286. Walls and Gates
    200. Number of Islands
    1. Two Sum
    名片管理系统(python实现)
    k近邻算法(简单版)
    基数排序
    递归算法的调试
  • 原文地址:https://www.cnblogs.com/luquanmingren/p/4648433.html
Copyright © 2011-2022 走看看