91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Android應用中怎么在底端顯示選項卡

發布時間:2020-11-24 15:24:14 來源:億速云 閱讀:124 作者:Leah 欄目:移動開發

這篇文章將為大家詳細講解有關Android應用中怎么在底端顯示選項卡,文章內容質量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關知識有一定的了解。

1.layout 文件

<&#63;xml version="1.0" encoding="utf-8" &#63;>
<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("發件箱",
    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("發送",
    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);
    }
  }
}

關于Android應用中怎么在底端顯示選項卡就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

界首市| 板桥市| 长泰县| 蒙山县| 延川县| 达孜县| 台东市| 馆陶县| 安新县| 新龙县| 张家界市| 开平市| 从江县| 四子王旗| 饶阳县| 临湘市| 江安县| 寿阳县| 芦山县| 北辰区| 原阳县| 龙陵县| 蛟河市| 夏河县| 遵化市| 南丰县| 永靖县| 葵青区| 青海省| 景洪市| 威远县| 孝感市| 沁阳市| 化德县| 泾川县| 通江县| 赣榆县| 天祝| 若尔盖县| 衡山县| 常熟市|