當前位置:首頁 » 安卓系統 » android選項卡

android選項卡

發布時間: 2022-01-25 11:24:44

⑴ Android中彈出嵌入選項卡的對話框,選項卡內容會重疊,單獨顯示選項卡會正常顯示,求大神們幫個忙!!!

你在onclick裡面彈出login的對話框後不是應該吧下面的注冊給關了么,再不行你就吧login的dialog弄的大一點。

⑵ android中的tabHost怎樣在點擊一個選項卡後跳轉到一個activity,點擊另一個選項卡跳轉到另一個activity

一個Tab頁,中間有個按鈕可以跳轉到另一個Activity

我的TabHost是
intent = new Intent(this,Activity01.class);//新建一個Intent用作Tab1顯示的內容
spec = tabHost.newTabSpec("tab1")//新建一個 Tab
.setIndicator("tab1")//設置名稱以及圖標
.setContent(intent);//設置顯示的intent,這里的參數也可以是R.id.xxx
tabHost.addTab(spec);//添加進tabHost
這個方式添加進來的,載入Acitivity01

⑶ android開發怎樣將Tab選項卡嵌入軟體的主界面

有點忘記了~但是好像不是繼承Activity是TABActivity~其他的可以找找教程..

⑷ android 如何想選項卡中添加按鈕和列表控制項

th.addTab(th.newTabSpec("綱手").setIndicator("木葉").setContent(R.id.a1));
setContent(R.id.a1));這個是想要載入的布局文件,在布局文件里設置按鈕等等就ok了

⑸ android 底部導航欄和選項卡的方式哪種更適合

最優的當然是ActionBar +viewPager + fragment

也可以用TabHost + viewPager + fragment

⑹ android怎麼做彈窗選項卡

你先吧這個頁面自定義好
dialog是可以addView的

實在不行也可要用Activity代替,Activity是可以吧Theme設置成dialog樣式的。具體可以招片文章看下

⑺ android中如何能是選項卡套用選項卡

我現在在嵌套,實現樂兩層,但是問題是:裡面的編輯框總是不能准確的輸入文本,苦惱了我兩天了,help

⑻ Android選項卡,一直報「TabWidget with id "android:id/tabs".」這個錯,試了好幾個API都不行

在布局中用TabHost,必須有一個TabWidget的子控制項,並且控制項id一定要是android預先定義的「android:id/tabs」,你只寫一個TabHost當然會報這個錯

⑼ android開發怎樣將Tab選項卡嵌入軟體主界面

卡錯誤地方:Causedby:java.lang.NullPointerException源碼:{//選項卡privateTabHost_tabHost;//滾動圖片privateViewPagerviewPager;privateList<ImageView>imageViews;privateString[]titles;privateint[]imageResId;privateList<View>dots;privateTextViewtv_title;privateintcurrentItem=0;;privateHandlerhandler=newHandler(){publicvoidhandleMessage(android.os.Messagemsg){viewPager.setCurrentItem(currentItem);};};//0.初始化@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);//主界面選項卡_tabHost=(TabHost)findViewById(android.R.id.tabhost);//_tabHost=getTabHost();AddTabPage();//設置對應圖片imageResId=newint[]{R.drawable.a,R.drawable.b,R.drawable.c,R.drawable.d,R.drawable.e};//設置對應標題titles=newString[imageResId.length];titles[0]="白日依山盡";titles[1]="黃河入海流";titles[2]="欲窮千里目";titles[3]="更上一層樓";titles[4]="路漫漫,其修遠兮,吾將上下而求索";imageViews=newArrayList<ImageView>();for(inti=0;i<imageResId.length;i++)

⑽ android中tab選項卡怎麼做

第一步
res/values/strings.xml

[xhtml] view plain
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, MyTabActivity!</string>
<string name="app_name">選項卡Demo</string>
<string name="andy">Andy Rubin--<a href="http://lib.csdn.net/base/15" class='replace_word' title="undefined" target='_blank' style='color:#df3434; font-weight:bold;'>Android</a>的創造者</string>
<string name="bill">Bill Joy--Java的創造者</string>
<string name="torvalds">Linus Torvalds --Linux之父</string>
</resources>

第二步
res/layout/tab_layout.xml

[xhtml] view plain
<?xml version="1.0" encoding="utf-8"?>
<!--
FrameLayout:一個FrameLayout對象好比一塊在屏幕上提前預定好的空白區域,
然後可以填充一些元素到里邊,比方說一張圖片等。
需要注意的是所有元素都被放置在FrameLayout區域的左上的區域,
而且無法為這些元素指定一個確切的位置。如果有多個元素,則後邊的會重疊在前一個元素上。

android:gravity用於設置View組件的對齊方式
(另外,android:layout_gravity用於設置Container組件的對齊方式)
center_horizontal 不改變控制項大小,對其到容器橫向中間位置(也就是在豎直方向的中間)

android:scaleType="fitXY" 把圖片不按比例來擴大或者縮小顯示
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:id="@+id/linearLayout1"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
>
<ImageView
android:id="@+id/imageView01"
android:layout_gravity="center"
android:scaleType="fitXY"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/andy"/>
<TextView
android:id="@+id/testView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dip"
android:text="@string/andy"
/>
</LinearLayout>

<LinearLayout android:id="@+id/linearLayout2"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
>
<ImageView
android:id="@+id/imageView02"
android:layout_gravity="center"
android:scaleType="fitXY"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bill"/>
<TextView
android:id="@+id/testView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dip"
android:text="@string/bill"
/>
</LinearLayout>

<LinearLayout android:id="@+id/linearLayout3"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
>
<ImageView
android:id="@+id/imageView03"
android:layout_gravity="center"
android:scaleType="fitXY"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/torvalds"/>
<TextView
android:id="@+id/testView03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dip"
android:text="@string/torvalds"
/>
</LinearLayout>
</FrameLayout>

第三步
src/com/myandroid/tab/MyTabActivity.java

[java] view plain
package com.myandroid.tab;

import android.app.TabActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.TabHost;

public class MyTabActivity extends TabActivity {

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TabHost tabHost = this.getTabHost();
/*
* LayoutInflater的作用類似於 findViewById(),
* 不同點是LayoutInflater是用來找layout文件夾下的xml布局文件,並且實例化
* 註:findViewById()只是找控制項之類(如Button和EditView)
*
* LayoutInflater.from(this)獲得context實例
* 也就是相當於this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
* LAYOUT_INFLATER_SERVICE 取得xml里定義的view
*-----------------------------------------------------------------------
* getSystemService:
* 根據傳入的NAME來取得對應的Object,然後轉換成相應的服務對象
* android的後台運行在很多service,
* 它們在系統啟動時被SystemServer開啟,支持系統的正常工作,
* 比如MountService監聽是否有SD卡安裝及移除,ClipboardService提供剪切板功能,
* 應用程序可以通過系統提供的Manager介面來訪問這些Service提供的數據
*-----------------------------------------------------------------------
*
* inflate是把xml表述的layout轉化為View
* tabHost.getTabContentView() 獲得Tab標簽頁的FrameLayout
* true表示將inflate綁定到根布局元素上
*/
LayoutInflater.from(this)
.inflate(R.layout.tab_layout,
tabHost.getTabContentView(), true);

/*
* tabHost.newTabSpec("Tab1") 創建TabHost.TabSpec,
* TabSpec即是選項卡的指示符,對於TabSpec可以設置一個標題或者設置一個標題和圖標
* setIndicator 是為選項卡指示符指定一個標簽和圖標
* setContent 為選項卡的內容指定視圖的ID
*/
tabHost.addTab(
tabHost.newTabSpec("Tab1")
.setIndicator("Tab1", getResources().getDrawable(R.drawable.png1)
).setContent(R.id.linearLayout1)
);
tabHost.addTab(
tabHost.newTabSpec("Tab2")
.setIndicator("Tab2", getResources().getDrawable(R.drawable.png2)
).setContent(R.id.linearLayout2)
);
tabHost.addTab(
tabHost.newTabSpec("Tab3")
.setIndicator("Tab3", getResources().getDrawable(R.drawable.png3)
).setContent(R.id.linearLayout3)
);
}

}

第四步
AndroidManifest.xml

[xhtml] view plain
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myandroid.tab"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MyTabActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
<uses-sdk android:minSdkVersion="8" />
</manifest>

附上出處鏈接:http://blog.csdn.net/jamesliulyc/article/details/6324432

熱點內容
替代編程 發布:2024-04-16 19:43:06 瀏覽:504
伺服器搭建多個網站教程 發布:2024-04-16 19:36:58 瀏覽:954
伺服器未發送數據是怎麼回事 發布:2024-04-16 19:20:30 瀏覽:77
android按鈕點擊 發布:2024-04-16 19:10:56 瀏覽:633
編程作文 發布:2024-04-16 18:52:12 瀏覽:656
芒果tv視頻緩存不了 發布:2024-04-16 18:51:07 瀏覽:960
php不等於空 發布:2024-04-16 18:50:55 瀏覽:784
十代半雅閣增加哪些配置 發布:2024-04-16 17:49:55 瀏覽:734
n皇後問題演算法 發布:2024-04-16 17:42:47 瀏覽:236
資料庫相關論文 發布:2024-04-16 17:20:31 瀏覽:17