Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2087918
  • 博文数量: 413
  • 博客积分: 10926
  • 博客等级: 上将
  • 技术积分: 3862
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-09 18:14
文章分类

全部博文(413)

文章存档

2015年(5)

2014年(1)

2013年(5)

2012年(6)

2011年(138)

2010年(85)

2009年(42)

2008年(46)

2007年(26)

2006年(59)

分类: 嵌入式

2010-09-10 11:28:15

  1. Documents
    • Reference
      http://developer.android.com/reference/android/app/TabActivity.html
      http://developer.android.com/reference/android/widget/TabHost.html
    • Samples
      • http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Tabs1.html
      • http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Tabs2.html
      • http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Tabs3.html
    • xxx
  2. TabHost
    • Get handle by invoking the method getTabHost() in subclass of TabActivity
    • Crate new tab by invoking TabHost.newTabSpec
    • Set string/image on tab bar by invoking TabHost.TabSpec.setIndicator (you can also customize tab bar)
    • Set contents in each tab by invoking TabHost.TabSpec.setContent
      In general, we use the following 3 methods to define the layout of each tab
      • Define layout of all tabs in one xml file
        (Plese refer to http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Tabs1.html)
      • Define layout of each tab in ont xml file
        (Plese refer to http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Tabs3.html)
      • Create layout of each tab in callback function
        (Plese refer to http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Tabs2.html)
    • xxx
  3. Change Text Color on Tab Indicator
    1. 1st Way
      TextView v;
      int i;
      TabWidget tw = (getTabHost().getTabWidget();
      for (i = 0; i < tw.getChildCount();i++)
      {
          v = (TextView).getChildAt(i).findViewById(android.R.id.title));
          v.setTextColor(Color.WHITE);
      }
    2. 2nd Way
      • Create a new XML file in res/drawable/ named tab_indicator.xml with the following contents:


           
                      android:state_selected="true" />
           
           
      • Add table contents as following:
        spec = tabHost.newTabSpec("artists").setIndicator("Artists",
                              getResources().getDrawable(R.drawable.tab_indicator))
                          .setContent(intent);
         tabHost.addTab(spec);
      • xxx
    3. xxx
  4. Samples:
    • http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
  5. xxx
阅读(989) | 评论(0) | 转发(0) |
0

上一篇:[Android] Preference

下一篇:[Java] Thread

给主人留下些什么吧!~~