zoukankan      html  css  js  c++  java
  • 线性布局--LinearLayout

    github:https://github.com/maogefff/AndroidLearning/tree/master/day01LinearLayout

    注意两个点:

    hint:在android中,以EditText(假设该控件是为了获取用户邮箱)为例,就是在用户没有输入的情况下,提示用户输入相应的内容,比如"请输入您的邮箱地址",一旦用户在控件中键入内容,该提示内容会自动消失;

    text:在android中,就是控件的文本信息了,比如用户输入的邮箱地址

     

    gravity:意思是这个控件自己的“重力”,在通俗点就是控件上面的东西的位置(图片,文本等)

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context="com.example.aplex.myapplication.MainActivity">
    
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="0"
            android:textColorHint="#000000"
            android:gravity="right"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
    
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:textColor="#F47B14"
                android:text="C"/>
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="DEL"/>
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="÷"/>
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="*"/>
        </LinearLayout>
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
    
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="7"/>
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="8"/>
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="9"/>
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="-"/>
        </LinearLayout>
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
    
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="4"/>
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="5"/>
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="6"/>
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="+"/>
        </LinearLayout>
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
    
            <LinearLayout
                android:layout_width="0dp"
                android:layout_weight="3"
                android:orientation="vertical"
                android:layout_height="wrap_content">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
    
                    <Button
                        android:layout_width="0dp"
                        android:layout_weight="1"
                        android:layout_height="wrap_content"
                        android:text="4"/>
                    <Button
                        android:layout_width="0dp"
                        android:layout_weight="1"
                        android:layout_height="wrap_content"
                        android:text="5"/>
                    <Button
                        android:layout_width="0dp"
                        android:layout_weight="1"
                        android:layout_height="wrap_content"
                        android:text="6"/>
                </LinearLayout>
    
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
    
                    <Button
                        android:layout_width="0dp"
                        android:layout_weight="1"
                        android:layout_height="wrap_content"
                        android:text="1"/>
                    <Button
                        android:layout_width="0dp"
                        android:layout_weight="1"
                        android:layout_height="wrap_content"
                        android:text="2"/>
                    <Button
                        android:layout_width="0dp"
                        android:layout_weight="1"
                        android:layout_height="wrap_content"
                        android:text="3"/>
                </LinearLayout>
            </LinearLayout>
    
            <Button
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="match_parent"
                android:text="="
                android:background="#F47B14"/>
        </LinearLayout>
    </LinearLayout>
  • 相关阅读:
    spring培训PPT
    如何创建新模块 DotNetNuke 6 & Entity Framework Code First
    博客园 漂浮快捷操作
    Ext.net中如何上传文件
    Excel与数据库之间的那些事
    关于SQL一对多关系转换的效率思考
    JQuery的结构Dive into jQuery
    《JAVA与模式》之简单工厂模式
    JSM SqlHelper 2.0 新特性(C#)
    mutex互斥锁
  • 原文地址:https://www.cnblogs.com/maogefff/p/8047352.html
Copyright © 2011-2022 走看看