欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

android 線性布局LinearLayout實(shí)例代碼

 更新時(shí)間:2013年05月29日 10:15:43   作者:  
android 線性布局LinearLayout實(shí)例代碼,需要的朋友可以參考一下

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

復(fù)制代碼 代碼如下:

[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
復(fù)制代碼 代碼如下:

[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
復(fù)制代碼 代碼如下:

[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
復(fù)制代碼 代碼如下:

[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;
復(fù)制代碼 代碼如下:

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:
復(fù)制代碼 代碼如下:

[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;
復(fù)制代碼 代碼如下:

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;
 }

}


最終效果:

相關(guān)文章

  • 基于Android自定義控件實(shí)現(xiàn)雷達(dá)效果

    基于Android自定義控件實(shí)現(xiàn)雷達(dá)效果

    這篇文章主要為大家詳細(xì)介紹了基于Android自定義控件實(shí)現(xiàn)雷達(dá)效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-07-07
  • Android編程實(shí)現(xiàn)自定義title功能示例

    Android編程實(shí)現(xiàn)自定義title功能示例

    這篇文章主要介紹了Android編程實(shí)現(xiàn)自定義title功能,結(jié)合具體實(shí)例形式分析了Android自定義title的具體實(shí)現(xiàn)步驟與相關(guān)操作技巧,需要的朋友可以參考下
    2017-03-03
  • Flutter 給列表增加下拉刷新和上滑加載更多功能

    Flutter 給列表增加下拉刷新和上滑加載更多功能

    在實(shí)際的 App 中,下拉刷新和上滑加載更多是非常常見的交互形式。在 Flutter 中,有 flutter_easyrefresh開源插件用于實(shí)現(xiàn)下拉刷新和上滑加載更多。本篇介紹了有狀態(tài)組件和 flutter_easyrefresh 的基本應(yīng)用,同時(shí)使用模擬的方式完成了異步數(shù)據(jù)加載。
    2021-05-05
  • 基于Android?Kotlin高頻面試題解析

    基于Android?Kotlin高頻面試題解析

    這篇文章主要為大家介紹了基于Android?Kotlin高頻面試題解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-07-07
  • 淺析Android Studio 3.0 升級各種坑(推薦)

    淺析Android Studio 3.0 升級各種坑(推薦)

    本文是小編給大家收藏整理的關(guān)于Android Studio 3.0 升級后遇到的一些坑,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下吧
    2017-11-11
  • Android高級動(dòng)畫篇之SVG矢量動(dòng)畫范例

    Android高級動(dòng)畫篇之SVG矢量動(dòng)畫范例

    矢量動(dòng)畫即是在計(jì)算機(jī)中使用數(shù)學(xué)方程來描述屏幕上復(fù)雜的曲線,利用圖形的抽象運(yùn)動(dòng)特征來記錄變化的畫面信息的動(dòng)畫,本篇帶你了解在Android中的矢量動(dòng)畫
    2021-11-11
  • Android實(shí)現(xiàn)圖片輪播列表

    Android實(shí)現(xiàn)圖片輪播列表

    這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)圖片輪播列表,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-06-06
  • Android曲線更圓滑的簽名畫板

    Android曲線更圓滑的簽名畫板

    這篇文章主要為大家詳細(xì)介紹了Android曲線更圓滑的簽名畫板,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-04-04
  • 通過OpenGL ES混合模式縮放視頻緩沖區(qū)來適應(yīng)顯示尺寸

    通過OpenGL ES混合模式縮放視頻緩沖區(qū)來適應(yīng)顯示尺寸

    當(dāng)開發(fā)基于軟件模式的游戲時(shí),通過縮放視頻緩沖區(qū)來適應(yīng)顯示尺寸是最棘手的問題之一;作為開發(fā)人員,我們必須嘗試在性能與顯示質(zhì)量之間找到最佳平衡點(diǎn)
    2012-12-12
  • Android Studio簽名打包的兩種方式(圖文教程)

    Android Studio簽名打包的兩種方式(圖文教程)

    這篇文章主要介紹了Android Studio簽名打包的兩種方式(圖文教程),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-10-10

最新評論