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

Android編程實現(xiàn)在底端顯示選項卡的方法

 更新時間:2017年02月23日 10:20:35   作者:藍之風(fēng)  
這篇文章主要介紹了Android編程實現(xiàn)在底端顯示選項卡的方法,涉及Android界面線性布局、相對布局及選項卡設(shè)置相關(guān)操作技巧,需要的朋友可以參考下

本文實例講述了Android編程實現(xiàn)在底端顯示選項卡的方法。分享給大家供大家參考,具體如下:

1.layout 文件

<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
  <TabHost android:id="@+id/edit_item_tab_host"
  android:layout_width="fill_parent" android:layout_height="fill_parent">
    <LinearLayout android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="5dp">
      <FrameLayout android:id="@android:id/tabcontent"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:padding="5dp" android:layout_weight="1">
        <LinearLayout android:id="@+id/widget_layout_Blue"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">
          <RelativeLayout android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:paddingLeft="3px"
          android:paddingRight="3px">
            <LinearLayout android:id="@+id/titleLayout_person_check_road_add"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            </LinearLayout>
            <LinearLayout
            android:id="@+id/layout_person_check_road_add"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/titleLayout_person_check_road_add"
            android:layout_alignTop="@id/titleLayout_person_check_road_add"
            android:orientation="vertical">
            </LinearLayout>
        </RelativeLayout>
    </LinearLayout>
    <LinearLayout android:id="@+id/widget_layout_red"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">
      <RelativeLayout android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:paddingLeft="3px" android:paddingRight="3px">
        <LinearLayout android:id="@+id/titleLayout_person_check_road_add1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        </LinearLayout>
        <LinearLayout
        android:id="@+id/layout_person_check_road_add1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/titleLayout_person_check_road_add1"
        android:layout_alignTop="@id/titleLayout_person_check_road_add1"
        android:orientation="vertical">
        </LinearLayout>
    </RelativeLayout>
</LinearLayout>
<LinearLayout android:id="@+id/widget_layout_green"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
  <RelativeLayout android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:paddingLeft="3px" android:paddingRight="3px">
    <LinearLayout android:id="@+id/titleLayout_person_check_road_add2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"> </LinearLayout>
    <LinearLayout android:id="@+id/layout_person_check_road_add2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@id/titleLayout_person_check_road_add2"
    android:layout_alignTop="@id/titleLayout_person_check_road_add2"
    android:orientation="vertical"> </LinearLayout>
  </RelativeLayout>
</LinearLayout>
<LinearLayout android:id="@+id/widget_layout_yellow"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
  <RelativeLayout android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:paddingLeft="3px" android:paddingRight="3px">
    <LinearLayout android:id="@+id/titleLayout_person_check_road_add3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"> </LinearLayout>
    <LinearLayout android:id="@+id/layout_person_check_road_add3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@id/titleLayout_person_check_road_add3"
    android:layout_alignTop="@id/titleLayout_person_check_road_add3"
    android:orientation="vertical"> </LinearLayout>
  </RelativeLayout>
</LinearLayout>
</FrameLayout>
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="0" /> </LinearLayout>
</TabHost>
</LinearLayout>

2.Java 文件

import android.app.ActivityGroup;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TabHost;
import android.widget.TextView;
public class TabBottom extends ActivityGroup {
  public static TabHost myTabhost;
  private LayoutParams title_params = new LayoutParams(120, 50);
  private LayoutParams content_params = new LayoutParams(158, 50);
  private LinearLayout titleLayout, showViewLayout, titleLayout1,
  showViewLayout1, titleLayout2, showViewLayout2, titleLayout3,
  showViewLayout3;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.bottomtab);
    myTabhost = (TabHost) findViewById(R.id.edit_item_tab_host);
    myTabhost.setup(this.getLocalActivityManager());
    titleLayout = (LinearLayout) findViewById(R.id.titleLayout_person_check_road_add);
    showViewLayout = (LinearLayout) findViewById(R.id.layout_person_check_road_add);
    titleLayout1 = (LinearLayout) findViewById(R.id.titleLayout_person_check_road_add1);
    showViewLayout1 = (LinearLayout) findViewById(R.id.layout_person_check_road_add1);
    titleLayout2 = (LinearLayout) findViewById(R.id.titleLayout_person_check_road_add2);
    showViewLayout2 = (LinearLayout) findViewById(R.id.layout_person_check_road_add2);
    titleLayout3 = (LinearLayout) findViewById(R.id.titleLayout_person_check_road_add3);
    showViewLayout3 = (LinearLayout) findViewById(R.id.layout_person_check_road_add3);
    myTabhost.addTab(myTabhost
    .newTabSpec("One")
    .setIndicator("收件箱",
    getResources().getDrawable(R.drawable.icon))
    .setContent(R.id.widget_layout_Blue));
    myTabhost.addTab(myTabhost
    .newTabSpec("Two")
    .setIndicator("發(fā)件箱",
    getResources().getDrawable(R.drawable.icon))
    .setContent(R.id.widget_layout_green));
    myTabhost.addTab(myTabhost
    .newTabSpec("Three")
    .setIndicator("垃圾箱",
    getResources().getDrawable(R.drawable.icon))
    .setContent(R.id.widget_layout_red));
    myTabhost.addTab(myTabhost
    .newTabSpec("Four")
    .setIndicator("發(fā)送",
    getResources().getDrawable(R.drawable.icon))
    .setContent(R.id.widget_layout_yellow));
    showInLayout();
    showInLayout1();
    showInLayout2();
    showInLayout3();
  }
  /*
  * 填充第一個選項卡頁面
  */
  private void showInLayout() {
    for (int i = 0; i < 10; i++) {
      String condName = "名稱顯示1";
      TextView tv = new TextView(this);
      tv.setTextColor(Color.WHITE);
      tv.setTextSize(16);
      tv.setLayoutParams(title_params);
      tv.setText(condName + ":");
      titleLayout.addView(tv);
      EditText tv1 = new EditText(this);
      tv1.setTextSize(16);
      tv1.setLayoutParams(content_params);
      tv1.setText(condName);
      showViewLayout.addView(tv1);
    }
  }
  private void showInLayout1() {
    for (int i = 0; i < 10; i++) {
      String condName = "名稱顯示2";
      TextView tv = new TextView(this);
      tv.setTextColor(Color.WHITE);
      tv.setTextSize(16);
      tv.setLayoutParams(title_params);
      tv.setText(condName + ":");
      titleLayout1.addView(tv);
      TextView tv1 = new TextView(this);
      tv1.setTextColor(Color.WHITE);
      tv1.setTextSize(16);
      tv1.setLayoutParams(content_params);
      tv1.setText(condName + ":");
      showViewLayout1.addView(tv1);
    }
  }
  private void showInLayout2() {
    for (int i = 0; i < 10; i++) {
      String condName = "名稱顯示3";
      TextView tv = new TextView(this);
      tv.setTextColor(Color.WHITE);
      tv.setTextSize(16);
      tv.setLayoutParams(title_params);
      tv.setText(condName + ":");
      titleLayout2.addView(tv);
      TextView tv1 = new TextView(this);
      tv1.setTextColor(Color.WHITE);
      tv1.setTextSize(16);
      tv1.setLayoutParams(content_params);
      tv1.setText(condName + ":");
      showViewLayout2.addView(tv1);
    }
  }
  private void showInLayout3() {
    for (int i = 0; i < 10; i++) {
      String condName = "名稱顯示4";
      TextView tv = new TextView(this);
      tv.setTextColor(Color.WHITE);
      tv.setTextSize(16);
      tv.setLayoutParams(title_params);
      tv.setText(condName + ":");
      titleLayout3.addView(tv);
      TextView tv1 = new TextView(this);
      tv1.setTextColor(Color.WHITE);
      tv1.setTextSize(16);
      tv1.setLayoutParams(content_params);
      tv1.setText(condName + ":");
      showViewLayout3.addView(tv1);
    }
  }
}

效果如下:

更多關(guān)于Android相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android開發(fā)入門與進階教程》、《Android編程之a(chǎn)ctivity操作技巧總結(jié)》、《Android資源操作技巧匯總》、《Android操作json格式數(shù)據(jù)技巧總結(jié)》、《Android數(shù)據(jù)庫操作技巧總結(jié)》、《Android編程開發(fā)之SD卡操作方法匯總》、《Android視圖View技巧總結(jié)》及《Android控件用法總結(jié)

希望本文所述對大家Android程序設(shè)計有所幫助。

相關(guān)文章

  • Android nativePollOnce函數(shù)解析

    Android nativePollOnce函數(shù)解析

    這篇文章主要介紹了Android nativePollOnce函數(shù)解析的相關(guān)資料,幫助大家更好的理解和學(xué)習(xí)使用Android,感興趣的朋友可以了解下
    2021-03-03
  • Android ActionBar完全解析使用官方推薦的最佳導(dǎo)航欄(下)

    Android ActionBar完全解析使用官方推薦的最佳導(dǎo)航欄(下)

    這篇文章主要介紹了Android ActionBar完全解析使用官方推薦的最佳導(dǎo)航欄(下) ,需要的朋友可以參考下
    2017-04-04
  • Android開發(fā)之AAR文件的生成與使用步驟

    Android開發(fā)之AAR文件的生成與使用步驟

    Android中的aar主要是針對于Android Library而言的,可以簡單的理解為是對Android Library的打包,這個包的格式為.aar,下面這篇文章主要給大家介紹了關(guān)于Android開發(fā)之AAR文件的生成與使用步驟的相關(guān)資料,需要的朋友可以參考下
    2022-07-07
  • Android增量升級的方法和原理詳細介紹

    Android增量升級的方法和原理詳細介紹

    這篇文章主要介紹了Android增量升級的方法和原理,有需要的朋友可以參考一下
    2014-01-01
  • Android布局控件DrawerLayout實現(xiàn)完美側(cè)滑效果

    Android布局控件DrawerLayout實現(xiàn)完美側(cè)滑效果

    這篇文章主要為大家詳細介紹了Android布局控件DrawerLayout實現(xiàn)完美側(cè)滑效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-08-08
  • Android開發(fā)中超好用的正則表達式工具類RegexUtil完整實例

    Android開發(fā)中超好用的正則表達式工具類RegexUtil完整實例

    這篇文章主要介紹了Android開發(fā)中超好用的正則表達式工具類RegexUtil,結(jié)合完整實例形式分析了Android正則表達式常見操作技巧,包括針對證件號、銀行賬號、手機號、郵編等的正則判斷相關(guān)操作技巧,需要的朋友可以參考下
    2017-11-11
  • android配合viewpager實現(xiàn)可滑動的標(biāo)簽欄示例分享

    android配合viewpager實現(xiàn)可滑動的標(biāo)簽欄示例分享

    本文主要介紹了android實現(xiàn)可滑動的標(biāo)簽欄示例,配合viewpager作為標(biāo)簽欄,且可以設(shè)置每頁顯示的標(biāo)簽個數(shù),超出可滑動顯示,需要的朋友可以參考下
    2014-02-02
  • Android中TelephonyManager用法實例

    Android中TelephonyManager用法實例

    這篇文章主要介紹了Android中TelephonyManager用法,結(jié)合實例形式分析了TelephonyManager類的功能,使用技巧與相關(guān)注意事項,需要的朋友可以參考下
    2016-03-03
  • Android Toast使用的簡單小結(jié)(推薦)

    Android Toast使用的簡單小結(jié)(推薦)

    這篇文章主要介紹了Android Toast使用的簡單小結(jié),本文通過實例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2021-03-03
  • Android動畫教程之屬性動畫詳解

    Android動畫教程之屬性動畫詳解

    這篇文章主要給大家介紹了關(guān)于Android動畫教程之屬性動畫的相關(guān)資料,文中通過示例代碼介紹的非常詳細,對各位Android開發(fā)者們具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-05-05

最新評論