开发者

Few questions about android TabHost

开发者 https://www.devze.com 2023-01-10 17:34 出处:网络
I\'m new in android and I have f开发者_运维知识库ew questions to ask. Is it possible to use the keypad (Left and Right) to move from one TabHost to another?

I'm new in android and I have f开发者_运维知识库ew questions to ask.

  1. Is it possible to use the keypad (Left and Right) to move from one TabHost to another?

  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?

  4. I have created a TabHost aligned to the bottom of the screen. How can I move the "line" on bottom of TabWidget to above? (see screenshot)

alt text 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. Thanks


3/ yes it's possible and if you use your own graphics like this, you will have a picture insidetab

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

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号