zoukankan      html  css  js  c++  java
  • android笔记一 控件属性

    <?xml version = "1.0" encoding = "utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_height="fill_parent"
        android:layout_width="fill_parent"    
        >
    
        <Button
            android:id="@+id/button_test"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp"
            android:layout_marginLeft="40dp"
            android:layout_marginRight="60dp"
            android:layout_marginBottom="100dp"
            android:text="我是第1个控件"
            android:textSize="12sp" />
    
        <Button
            android:id="@+id/button_test1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingTop="15sp"
            android:layout_below="@+id/button_test"
            android:paddingLeft="20sp"
            android:layout_gravity="right"
            android:text="我是第2个控件"
            android:textSize="12sp" />
    
        <ListView
            android:id="@+id/list"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/button_test1" />
    
    </LinearLayout>
    <Button
            android:id="@+id/button_test"
            android:layout_width="wrap_content"//大小刚刚可以包住文本
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp"//相对上方控件的距离
            android:layout_marginLeft="40dp"//相对左边控件的距离
            android:layout_marginRight="60dp"//相对右边控件的距离
            android:layout_marginBottom="100dp"//相对下方控件的距离
            android:text="我是第1个控件"
            android:textSize="12sp" />//设置文本的大小
    
        <Button
            android:id="@+id/button_test1"
            android:layout_width="match_parent"//宽度跟父窗口是一样的
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:paddingTop="15sp"
            android:layout_below="@+id/button_test"//使该控件一直在第一个控件的下方
            android:paddingLeft="20sp"//文本相对控件左边的距离
            android:gravity="right"//表示文本的对齐方式
            android:text="我是第2个控件"
            android:textSize="12sp" />
  • 相关阅读:
    linux 查看数据库和表
    使用Java实现发送email邮件
    kafka使用说明书
    关于hadoop各种项目中用到的maven依赖
    阿里云服务器快速搭建自己的个人网站
    CentOS7命令大全
    solr中文分词
    windows安装MySQL详细图解过程
    spark数据倾斜分析与解决方案
    浅谈KMlib(机器学习)
  • 原文地址:https://www.cnblogs.com/newlist/p/3255348.html
Copyright © 2011-2022 走看看