亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 系統 > Android > 正文

android 線性布局LinearLayout實例代碼

2020-04-11 12:18:45
字體:
來源:轉載
供稿:網友

布局文件:res/layout/activity_my.xml

復制代碼 代碼如下:

[html]  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal"
    tools:context=".MyActivity" >

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/wo"
        android:textColorHint="@color/calamus" />

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

    <Button
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/hao"
        android:textColor="@color/calamus" />

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

</LinearLayout>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal"
    tools:context=".MyActivity" >

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/wo"
        android:textColorHint="@color/calamus" />

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

    <Button
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/hao"
        android:textColor="@color/calamus" />

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

</LinearLayout>


資源文件:res/values/strings.xml
復制代碼 代碼如下:

[html] view plaincopyprint?<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Linear</string>
    <string name="action_settings">Settings</string>
    <string name="wo">我</string>
    <string name="shi">是</string>
    <string name="hao">好</string>
    <string name="ren">人</string>

</resources>

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Linear</string>
    <string name="action_settings">Settings</string>
    <string name="wo">我</string>
    <string name="shi">是</string>
    <string name="hao">好</string>
    <string name="ren">人</string>

</resources>


資源文件:res/values/styles.xml
復制代碼 代碼如下:

[html] view plaincopyprint?<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>
    <color name="calamus">#c77eb5</color>

</resources>

<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>
    <color name="calamus">#c77eb5</color>

</resources>


資源索引文件R.java
復制代碼 代碼如下:

[java] view plaincopyprint?/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package com.eirc.linear;

public final class R {
    public static final class attr {
    }
    public static final class color {
        public static final int calamus=0x7f070000;
    }
    public static final class dimen {
        /**  Default screen margins, per the Android Design guidelines.

         Customize dimensions originally defined in res/values/dimens.xml (such as
         screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.

         */
        public static final int activity_horizontal_margin=0x7f040000;
        public static final int activity_vertical_margin=0x7f040001;
    }
    public static final class drawable {
        public static final int ic_launcher=0x7f020000;
    }
    public static final class id {
        public static final int LinearLayout=0x7f090000;
        public static final int action_settings=0x7f090005;
        public static final int button1=0x7f090001;
        public static final int button2=0x7f090002;
        public static final int button3=0x7f090003;
        public static final int button4=0x7f090004;
    }
    public static final class layout {
        public static final int activity_my=0x7f030000;
    }
    public static final class menu {
        public static final int my=0x7f080000;
    }
    public static final class string {
        public static final int action_settings=0x7f050001;
        public static final int app_name=0x7f050000;
        public static final int hao=0x7f050004;
        public static final int ren=0x7f050005;
        public static final int shi=0x7f050003;
        public static final int wo=0x7f050002;
    }
    public static final class style {
        /**
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.

 
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.

 
        Base application theme for API 11+. This theme completely replaces
        AppBaseTheme from res/values/styles.xml on API 11+ devices.

 API 11 theme customizations can go here.

        Base application theme for API 14+. This theme completely replaces
        AppBaseTheme from BOTH res/values/styles.xml and
        res/values-v11/styles.xml on API 14+ devices.

 API 14 theme customizations can go here.
         */
        public static final int AppBaseTheme=0x7f060000;
        /**  Application theme.
 All customizations that are NOT specific to a particular API-level can go here.
         */
        public static final int AppTheme=0x7f060001;
    }
}

/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */


package com.eirc.linear;
復制代碼 代碼如下:

public final class R {
    public static final class attr {
    }
    public static final class color {
        public static final int calamus=0x7f070000;
    }
    public static final class dimen {
        /**  Default screen margins, per the Android Design guidelines.

         Customize dimensions originally defined in res/values/dimens.xml (such as
         screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.

         */
        public static final int activity_horizontal_margin=0x7f040000;
        public static final int activity_vertical_margin=0x7f040001;
    }
    public static final class drawable {
        public static final int ic_launcher=0x7f020000;
    }
    public static final class id {
        public static final int LinearLayout=0x7f090000;
        public static final int action_settings=0x7f090005;
        public static final int button1=0x7f090001;
        public static final int button2=0x7f090002;
        public static final int button3=0x7f090003;
        public static final int button4=0x7f090004;
    }
    public static final class layout {
        public static final int activity_my=0x7f030000;
    }
    public static final class menu {
        public static final int my=0x7f080000;
    }
    public static final class string {
        public static final int action_settings=0x7f050001;
        public static final int app_name=0x7f050000;
        public static final int hao=0x7f050004;
        public static final int ren=0x7f050005;
        public static final int shi=0x7f050003;
        public static final int wo=0x7f050002;
    }
    public static final class style {
        /**
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
  

            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
      

        Base application theme for API 11+. This theme completely replaces
        AppBaseTheme from res/values/styles.xml on API 11+ devices.

 API 11 theme customizations can go here.

        Base application theme for API 14+. This theme completely replaces
        AppBaseTheme from BOTH res/values/styles.xml and
        res/values-v11/styles.xml on API 14+ devices.

 API 14 theme customizations can go here.
         */
        public static final int AppBaseTheme=0x7f060000;
        /**  Application theme.
 All customizations that are NOT specific to a particular API-level can go here.
         */
        public static final int AppTheme=0x7f060001;
    }
}


Activity:
復制代碼 代碼如下:

[java] view plaincopyprint?package com.eirc.linear;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MyActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present. 
        getMenuInflater().inflate(R.menu.my, menu);
        return true;
    }

}

package com.eirc.linear;
復制代碼 代碼如下:

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MyActivity extends Activity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_my);
 }

 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
  // Inflate the menu; this adds items to the action bar if it is present.
  getMenuInflater().inflate(R.menu.my, menu);
  return true;
 }

}


最終效果:

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
久久亚洲国产精品成人av秋霞| 国产视频亚洲精品| 亚洲激情自拍图| 欧美精品手机在线| 精品福利一区二区| 57pao成人国产永久免费| 69视频在线免费观看| 九九视频直播综合网| 国产精品欧美日韩| 欧美黄色www| 国产精品美女在线观看| 国产亚洲视频在线观看| 日韩欧美国产激情| 羞羞色国产精品| 欧美在线国产精品| 午夜精品一区二区三区在线视频| 成人免费在线网址| 欧美色视频日本版| 欧美夜福利tv在线| 精品偷拍各种wc美女嘘嘘| 国产亚洲a∨片在线观看| 成人日韩av在线| 亚洲男人天堂网站| 亚洲欧美中文在线视频| 亚洲人成绝费网站色www| 色www亚洲国产张柏芝| 日韩久久免费电影| 亚洲大胆人体av| 欧美裸体xxxx极品少妇| 欧美影院成年免费版| 欧美麻豆久久久久久中文| 国产欧美婷婷中文| 亚洲最新中文字幕| 韩国视频理论视频久久| 国内精品视频一区| 亚洲性视频网址| 欧美成人亚洲成人| 亚洲欧美自拍一区| 欧美成人免费全部观看天天性色| 欧美另类暴力丝袜| 国产美女搞久久| 亚洲国产欧美久久| 国内外成人免费激情在线视频网站| 欧美精品www在线观看| 亚洲天堂男人天堂| 欧美午夜片在线免费观看| 国产日韩精品在线| 日韩精品免费在线视频观看| 高清欧美一区二区三区| 欧美性xxxx18| 精品久久久国产| 亚洲最大av在线| 国产成人高清激情视频在线观看| 国产精品爽爽爽| 久久网福利资源网站| 欧美精品福利在线| 亚洲欧美日韩精品久久| 成人h片在线播放免费网站| 国产视频精品va久久久久久| 久久在线观看视频| 亚洲风情亚aⅴ在线发布| 国产精品天天狠天天看| 亚洲国产精品99| 亚洲天堂影视av| 色与欲影视天天看综合网| 亚洲精品二三区| 欧美另类第一页| 久久精品国产久精国产思思| 中文字幕欧美精品日韩中文字幕| 国内精品小视频| 日本精品视频在线观看| 国外成人在线播放| 91精品国产99久久久久久| 中文字幕av一区二区| 成人a视频在线观看| 久久久久久久久亚洲| 欧美裸体男粗大视频在线观看| 色妞在线综合亚洲欧美| 精品亚洲一区二区三区| 色综合导航网站| 日韩成人网免费视频| 亚洲国产一区自拍| 国产一区二区激情| 91精品国产综合久久香蕉922| 91久久中文字幕| 国产精品视频26uuu| 亚洲老司机av| 亚洲三级 欧美三级| 8090理伦午夜在线电影| 久久久久久久久久久网站| 国产美女91呻吟求| 国模吧一区二区三区| 国产一区玩具在线观看| xvideos亚洲人网站| 久久久欧美精品| 亚洲直播在线一区| 欧美性高潮在线| 国产在线观看精品| 欧美成人在线免费视频| 日韩女优在线播放| 国产亚洲激情视频在线| 欧美国产精品日韩| 最新的欧美黄色| 欧美成人免费观看| 日本国产精品视频| 国产mv久久久| 一区二区三区国产在线观看| 亚洲视频欧美视频| 久久久久久久久亚洲| 亚洲精品国产精品国产自| 韩剧1988在线观看免费完整版| 亚洲第一福利视频| 91精品国产综合久久香蕉922| 亚洲美腿欧美激情另类| 欧美在线免费视频| 精品视频偷偷看在线观看| 欧美日韩另类字幕中文| 久久av中文字幕| 亚洲精品国产综合久久| 亚洲激情成人网| 国内精品久久久久久久久| 国产亚洲a∨片在线观看| 在线亚洲欧美视频| 欧美电影电视剧在线观看| 国产性猛交xxxx免费看久久| 国产亚洲精品久久久| 日韩美女写真福利在线观看| 国产视频精品免费播放| 亚洲人成伊人成综合网久久久| 91超碰caoporn97人人| 亚洲成人精品视频在线观看| 久久久亚洲欧洲日产国码aⅴ| 欧美日韩国产麻豆| 中文字幕日韩欧美精品在线观看| 久久人人爽人人爽人人片av高请| 国产精选久久久久久| 伊人久久久久久久久久久久久| 欧美色道久久88综合亚洲精品| 亚洲精品久久久久久下一站| 亚洲第一精品久久忘忧草社区| 久久中文字幕在线视频| 91中文精品字幕在线视频| 国产91成人在在线播放| 亚洲精品美女视频| 亚洲国产精品视频在线观看| 日韩欧美高清视频| 欧美日韩在线视频一区| 日韩精品欧美激情| 亚洲国产日韩欧美在线图片| 永久免费毛片在线播放不卡| 欧美日韩国产精品| 中文在线资源观看视频网站免费不卡| 日韩欧美在线视频观看| 蜜臀久久99精品久久久久久宅男| 日韩欧美在线播放| 高清欧美一区二区三区| 国产精品电影网站| 久久成人精品一区二区三区| 国产精品一区二区三区成人| 91免费在线视频网站| 国产精品久久一区| 97久久久免费福利网址| 亚洲视频综合网| 成人国产精品日本在线|