关于android TabHost的几个问题

发布于 2024-09-13 03:42:51 字数 637 浏览 2 评论 0原文

我是 Android 新手,有几个问题要问。

  1. 是否可以使用键盘(左和右)从一个 TabHost 移动到另一个 TabHost?

  2. 我成功更改了列表视图中的选择器颜色,那么如何更改文本 ListView 中的颜色也是如此?

  3. 是否可以通过自己的图形更改TabHost布局?

  4. 我创建了一个与屏幕底部对齐的 TabHost。如何将 TabWidget 底部的“线”移动到上面? (参见屏幕截图)

替代文本 http://desmond.yfrog.com/Himg251/scaled.php?tn=0&ser​​ver=251&filename=tabwidget.png&xsize=640&ysize=640

您的回复是非常感谢。 谢谢。

P/S:抱歉我的英语不好,希望你们明白我在说什么。 谢谢

I'm new in android and I have few 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瀟灑尐姊 2024-09-20 03:42:51

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/您可以尝试这个,我不确定,但我认为它有效,请将其放入您的班级中

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

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;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文