zoukankan      html  css  js  c++  java
  • Android Studio [水平布局LinearLayout]

     1 <?xml version="1.0" encoding="utf-8"?>
     2 <LinearLayout
     3     xmlns:android="http://schemas.android.com/apk/res/android"
     4     xmlns:tools="http://schemas.android.com/tools"
     5     xmlns:app="http://schemas.android.com/apk/res-auto"
     6     android:layout_width="match_parent"
     7     android:layout_height="match_parent"
     8     android:orientation="vertical"
     9     tools:context=".MainActivity">
    10 
    11     <LinearLayout
    12         android:id="@+id/ll_1"
    13         android:layout_width="200dp"
    14         android:layout_height="200dp"
    15         android:background="#000000"
    16         android:orientation="vertical"
    17         android:padding="20dp">
    18 
    19         <View
    20             android:layout_width="match_parent"
    21             android:layout_height="match_parent"
    22             android:background="#a42525" />
    23 
    24     </LinearLayout>
    25     <LinearLayout
    26         android:layout_width="match_parent"
    27         android:layout_height="200dp"
    28         android:orientation="horizontal"
    29         android:background="#0066FF"
    30         android:layout_marginTop="20dp"
    31         android:gravity="center_vertical">
    32         <View
    33             android:layout_width="0dp"
    34             android:layout_height="200dp"
    35             android:background="#000000"
    36             android:layout_weight="1"
    37             />
    38         <View
    39             android:layout_width="0dp"
    40             android:layout_height="200dp"
    41             android:background="#ef0000"
    42             android:layout_weight="1"
    43             />
    44     </LinearLayout>
    45 </LinearLayout>

    今天学习到的:

      

    <LinearLayout  +代码
    > </LinearLayout>水平布局
    android:layout_width="?dp"宽度
    android:layout_height="?dp"高度
    android:background="#ef0000"背景颜色
    android:layout_weight="1"块所占的权重
    android:gravity="center_vertical">对齐方式
    android:orientation="vertical"排列方式 水平/竖直
    结果:

    
    
  • 相关阅读:
    中风后遗症
    慢性湿疹半年
    女子脚背痒肿案
    肾盂肾炎病案
    鼻衄二则
    糖尿病病案
    慢性肠炎2例
    子宫肌瘤病案2例
    眩晕病案
    前列腺炎病案3例
  • 原文地址:https://www.cnblogs.com/zlc364624/p/10700833.html
Copyright © 2011-2022 走看看