简体   繁体   English

关于Android TabHost的几个问题

[英]Few questions about android TabHost

I'm new in android and I have few questions to ask. 我是android的新手,我有几个问题要问。

  1. Is it possible to use the keypad (Left and Right) to move from one TabHost to another? 是否可以使用键盘(左和右)从一个TabHost移动到另一个?

  2. I successfully changed the selector color in listview, then how can I change the text color in ListView as well? 我成功地更改了列表视图中的选择器颜色,那么如何更改列表视图中的文本颜色呢?

  3. Is it possible change the TabHost layout by own graphics? 是否可以通过自己的图形更改TabHost布局?

  4. I have created a TabHost aligned to the bottom of the screen. 我创建了一个TabHost,它与屏幕底部对齐。 How can I move the "line" on bottom of TabWidget to above? 如何将TabWidget底部的“线”移动到上方? (see screenshot) (请参见屏幕截图)

alt text http://desmond.yfrog.com/Himg251/scaled.php?tn=0&server=251&filename=tabwidget.png&xsize=640&ysize=640 替代文字http://desmond.yfrog.com/Himg251/scaled.php?tn=0&server=251&filename=tabwidget.png&xsize=640&ysize=640

Your reply is very appreciated. 非常感谢您的回复。 Thank you. 谢谢。

P/S: sorry about my bad english, hope you guys understand what I'm talking about. P / S:对我的英语不好对不起,希望你们明白我在说什么。 Thanks 谢谢

3/ yes it's possible and if you use your own graphics like this, you will have a picture insidetab 3 /是的,这是可能的,并且如果您使用自己的图形,您将获得一张图片。

int tab_list_on;
private TabHost mTabHost;

mTabHost = getTabHost();

tab_list_on = R.drawable.onglet_480_liste;
TabImgFond1 = new ImageView(this, null, android.graphics.Typeface.NORMAL);
TabImgFond1.setImageResource(tab_list_on);

mTabHost.addTab(mTabHost.newTabSpec(TAB_LISTE).setIndicator(TabImgFond1).setContent(intentList));

mTabHost.setOnTabChangedListener(new OnTabChangeListener() {
    public void onTabChanged(String tabId) {
    TabChangedState(tabId);
    }
});
mTabHost.setCurrentTab(0);

1/you can try this, i'm not sure, but i think it's working, put this inside your class 1 /您不确定,可以尝试一下,但是我认为这很有效,请将其放入您的班级

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.i(TAG,"CODE : "+keyCode);
if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
    //TODO
    return true;
}
return false;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM