zoukankan      html  css  js  c++  java
  • Android的开始之线性布局

    <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">

    //android:layout_gravity :表示子元素位于父元素的垂直位置,
    //android:gravity="center"--表示控件内部元素位于该控件的位置
    // android:layout_weight="2"权重越大,所占的空间比例越大

    //android:orientation="vertical">//布局方向:纵向

    //android:layout_width="match_parent"//布局的宽度

    // android:layout_height="wrap_content"布局的长度
    <LinearLayout
    android:layout_width="200dp"
    android:layout_height="wrap_content"

    android:layout_gravity="center"
    android:background="#CCCCCC"

    android:gravity="right">

    <Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Button" />

    </LinearLayout>

    <LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#CCCCFF"
    android:orientation="vertical">

    <Button
    android:id="@+id/one"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:text="one" />

    <Button
    android:id="@+id/button2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="2"
    android:text="two" />

    <Button
    android:id="@+id/button3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="3"
    android:text="three" />
    </LinearLayout>

    </LinearLayout>

  • 相关阅读:
    SICP 1.9-1.10
    SICP 1.6-1.8
    SICP 1.1-1.5
    【最小生成树】Codeforces 707B Bakery
    【数学】Codeforces 707C Pythagorean Triples
    【离线】【深搜】【树】Codeforces 707D Persistent Bookcase
    【贪心】Vijos P1615 旅行
    【字符串】【最小表示法】Vijos P1683 有根树的同构问题
    【模拟】Vijos P1005 超长数字串
    【并查集】【模拟】Codeforces 698B & 699D Fix a Tree
  • 原文地址:https://www.cnblogs.com/my334420/p/6435469.html
Copyright © 2011-2022 走看看