- 浏览: 62666 次
- 性别:
- 来自: 沈阳
文章分类
最新评论
// mTabHost定义在Activity的属性
mTabHost = (TabHost) findViewById(R.id.tabhost);
mTabHost.setup();
LayoutInflater factory = null;
// 未开始
factory = LayoutInflater.from(this);
final View notStartview = factory.inflate(R.layout.tab,null);
TextView notStartTextView = (TextView)notStartview.findViewById(R.id.tabName);
notStartTextView.setText(getText(R.string.text_tab_notstart));
notStartTextView
.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab));
// 进行中
factory = LayoutInflater.from(this);
final View playingView = factory.inflate(R.layout.tab,null);
TextView playingTextView = (TextView)playingView.findViewById(R.id.tabName);
playingTextView.setText(getText(R.string.text_tab_playing));
playingTextView.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab_act));
// 已完场
factory = LayoutInflater.from(this);
final View finishView = factory.inflate(R.layout.tab,null);
TextView finishTextView = (TextView)finishView.findViewById(R.id.tabName);
finishTextView.setText(getText(R.string.text_tab_finish));
finishTextView.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab));
// 关注
factory = LayoutInflater.from(this);
final View focusView = factory.inflate(R.layout.tab,null);
TextView focusTextView = (TextView)focusView.findViewById(R.id.tabName);
focusTextView.setText(getText(R.string.text_tab_focus));
focusTextView.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab));
// 未开始
mTabHost.addTab(mTabHost.newTabSpec("tab_not_begin")
.setIndicator(notStartview)
.setContent(R.id.textview_notbegin));
// 进行中
mTabHost.addTab(mTabHost.newTabSpec("tab_playing")
.setIndicator(playingView)
.setContent(R.id.textview_playing));
// 已完场
mTabHost.addTab(mTabHost.newTabSpec("tab_finish")
.setIndicator(finishView)
.setContent(R.id.textview_finish));
// 关注
mTabHost.addTab(mTabHost.newTabSpec("tab_focus")
.setIndicator(focusView)
.setContent(R.id.textview_focus));
// 修改宽度,作用两个(关注)与三个字(进行中,已完场)占有不同,三个字宽度大一些
for (int i =0; i < mTabHost.getTabWidget().getChildCount(); i++) {
mTabHost.getTabWidget().getChildAt(i).getLayoutParams().height = DisplayUtil.dip2px(this, 33);
if(i == 1 || i== 2){
mTabHost.getTabWidget().getChildAt(i).getLayoutParams().width = 18;
} else{
mTabHost.getTabWidget().getChildAt(i).getLayoutParams().width = 10;
}
}
// 设置当前选中的Tab
mTabHost.setCurrentTab(1);
mTabHost.getTabWidget().getChildAt(mTabHost.getCurrentTab()).setBackgroundColor(Color.BLACK);
// tab 选中改变时事件
mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
public void onTabChanged(String arg0) {
for(int i=0;i<mTabHost.getTabWidget().getChildCount();i++){
mTabHost.getTabWidget().getChildAt(i).findViewById(R.id.tabName)
.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab));
}
mTabHost.getTabWidget().getChildAt(mTabHost.getCurrentTab())
.findViewById(R.id.tabName)
.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab_act));
}
});
mTabHost = (TabHost) findViewById(R.id.tabhost);
mTabHost.setup();
LayoutInflater factory = null;
// 未开始
factory = LayoutInflater.from(this);
final View notStartview = factory.inflate(R.layout.tab,null);
TextView notStartTextView = (TextView)notStartview.findViewById(R.id.tabName);
notStartTextView.setText(getText(R.string.text_tab_notstart));
notStartTextView
.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab));
// 进行中
factory = LayoutInflater.from(this);
final View playingView = factory.inflate(R.layout.tab,null);
TextView playingTextView = (TextView)playingView.findViewById(R.id.tabName);
playingTextView.setText(getText(R.string.text_tab_playing));
playingTextView.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab_act));
// 已完场
factory = LayoutInflater.from(this);
final View finishView = factory.inflate(R.layout.tab,null);
TextView finishTextView = (TextView)finishView.findViewById(R.id.tabName);
finishTextView.setText(getText(R.string.text_tab_finish));
finishTextView.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab));
// 关注
factory = LayoutInflater.from(this);
final View focusView = factory.inflate(R.layout.tab,null);
TextView focusTextView = (TextView)focusView.findViewById(R.id.tabName);
focusTextView.setText(getText(R.string.text_tab_focus));
focusTextView.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab));
// 未开始
mTabHost.addTab(mTabHost.newTabSpec("tab_not_begin")
.setIndicator(notStartview)
.setContent(R.id.textview_notbegin));
// 进行中
mTabHost.addTab(mTabHost.newTabSpec("tab_playing")
.setIndicator(playingView)
.setContent(R.id.textview_playing));
// 已完场
mTabHost.addTab(mTabHost.newTabSpec("tab_finish")
.setIndicator(finishView)
.setContent(R.id.textview_finish));
// 关注
mTabHost.addTab(mTabHost.newTabSpec("tab_focus")
.setIndicator(focusView)
.setContent(R.id.textview_focus));
// 修改宽度,作用两个(关注)与三个字(进行中,已完场)占有不同,三个字宽度大一些
for (int i =0; i < mTabHost.getTabWidget().getChildCount(); i++) {
mTabHost.getTabWidget().getChildAt(i).getLayoutParams().height = DisplayUtil.dip2px(this, 33);
if(i == 1 || i== 2){
mTabHost.getTabWidget().getChildAt(i).getLayoutParams().width = 18;
} else{
mTabHost.getTabWidget().getChildAt(i).getLayoutParams().width = 10;
}
}
// 设置当前选中的Tab
mTabHost.setCurrentTab(1);
mTabHost.getTabWidget().getChildAt(mTabHost.getCurrentTab()).setBackgroundColor(Color.BLACK);
// tab 选中改变时事件
mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
public void onTabChanged(String arg0) {
for(int i=0;i<mTabHost.getTabWidget().getChildCount();i++){
mTabHost.getTabWidget().getChildAt(i).findViewById(R.id.tabName)
.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab));
}
mTabHost.getTabWidget().getChildAt(mTabHost.getCurrentTab())
.findViewById(R.id.tabName)
.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab_act));
}
});
发表评论
-
android 备用
2014-08-03 13:26 417http://blog.csdn.net/rain_butte ... -
Android中px与dip,sp与dip等的转换工具类(转)
2014-07-16 20:07 569http://www.cnblogs.com/wader201 ... -
android 字体总结
2014-07-15 21:53 522Android提供三种字体:“Sans”,“serif“和“m ... -
mina
2014-07-03 14:12 477http://chwshuang.iteye.com/blog ... -
android获取IMEI
2014-06-17 08:34 502核心代码: Imei = ((TelephonyMan ... -
andorid ui
2014-06-04 22:39 0http://blog.csdn.net/ddddpow/ar ... -
android alarmManage
2014-05-28 21:47 664转自:http://jinguo.iteye.com/bl ... -
adaf
2014-05-27 22:32 0http://www.eoeandroid.com/thr ... -
weixin
2014-05-13 22:42 0android weisixn -
jpajpa
2014-01-28 15:06 483http://www.iteye.com/problems/9 ... -
吉安帕
2014-01-23 22:30 0dfsgdaffgadrgad -
CrudRepository
2013-11-28 19:58 0PagingAndSortingRepository Cr ... -
Android 的第三方报表组件,AChartEngine 案列
2013-08-19 16:48 0http://www.kuaipan.cn/file/id_3 ... -
android sdk adress
2013-08-12 13:23 447developer.android.com/sdk/index ... -
android 结束进程
2013-07-29 22:01 700Android获取apk的版本及包名等信息 http://bl ... -
adnroid 4.0.3去掉虚拟导航栏
2013-07-27 20:54 1009http://blog.csdn.net/wfh1988/ar ... -
andorid全屏
2013-07-27 10:15 766super.onCreate(savedIns ... -
Foursquare
2012-10-12 17:22 0Foursquare -
sqllite brower
2012-09-11 23:05 639http://www.oschina.net/p/sqlite ... -
notice
2012-09-03 21:13 668http://tibaloga.iteye.com/blog/ ...
相关推荐
import android.app.AlertDialog; import android.app.Dialog; import android.app.TabActivity; import android.content.DialogInterface; import android.graphics.Color; import android.os.Bundle; import ...
package com.caigang.test; import android.app.TabActivity; import android.content.Intent; import android.os.Bundle; import android.view.GestureDetector; import android.view.GestureDetector....
PagerTabIndicator is a customisable android library that is designed to work with the ViewPager component. Features Support dynamic adapter switch of the ViewPager Customizable tab indicator (bottom/...
Ninja Yet another web browser for Android. Ninja in 酷安 Ninja in 少数派 ...html5test access 509UP with latest Android System WebView. Adblock and whitelist. Readability. Capture whole pag
kolabnotes-android Kolab Notes is the open source note taking app, which makes it possible to sync your notes with Kolab and IMAP server in the Kolab v3 storage format. The apk in the GitHub Releases ...
│ │ ├─androidTest │ │ │ └─java │ │ │ └─com │ │ │ └─bob │ │ │ └─arclayout │ │ │ ApplicationTest.java │ │ │ │ │ └─main │ │ │ AndroidManifest.xml │ │ │ ...
Tab与TabHost: 这就是Tab,而盛放Tab的容器就是TabHost 。 如何实现?? 每一个Tab还对应了一个布局,这个就...package zyf.tab.test; import android.app.TabActivity; public class MyTab extends TabActivity {
* 判断testDate+testTime是否在两个时间之内 375 附录: 378 附录1、XML布局中的常用属性 378 1.通用属性 378 2.Edit Text部分属性 381 3.layout_alignParentRight android:paddingRight 384 附录2、INTENT ...
* 判断testDate+testTime是否在两个时间之内 375 附录: 378 附录1、XML布局中的常用属性 378 1.通用属性 378 2.Edit Text部分属性 381 3.layout_alignParentRight android:paddingRight 384 附录2、INTENT ...
高通平台实时抓取蓝牙btsnoop的工具及方法说明,配合Frontline Test System使用。在高通625平台开发板及小米手机上验证可用。
其实,你可以轮播任何view,也可作为tab或viewPager的指示器使用。问题:多次调用AutoScroll()自动播放时,播放速度回成倍增加,这个因为作者没有判断当前是否正在播放。我的demo中对这个问题进行了处理。项目地址:...
Build a tab-based National Park explorer app with Google Map integration Develop a weather app with the Darksky weather API and Google’s GeoCode API Debug and test your app to resolve issues that ...
场景:使用Fragment实现切页。 类结构: 一:Activity Activity中使用...getSupportFragmentManager().beginTransaction().add(R.id.f_tab_fragment,fragment).commit(); XML: <Fram
实现 图片的放大,缩小,左右屏幕滑动 。 直接贴代码吧。。 public class ViewPager extends ViewGroup { private static final String TAG = "ViewPager"; private static final boolean DEBUG = false;...
1)....Added "ECC32TradeSpeedForMemory" option - defaults to 0/False, could be changed to 1 via Custom/Manual tab. This option will switch from fast-methods to slower methods, but which take less ...
”在此之前,谷歌已经推出了手机操作系统Android,另外,数款上网本也使用了这款操作系统。 长期以来,谷歌一直致力于计算机软件对于互联网的兼容性,以取代以计算机为中心的软件开发方式。谷歌希望,能够开发出...
d/buildroot-config/conf.o /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/zconf.tab.o -o /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/...
-rwx------ 1 rootroot rootroot 8557328646 12月 2 16:08 android_parrotv1.1_20161202.tar.gz* drwxrwxr-x 7 rootroot rootroot 4096 12月 2 15:52 lichee/ -rwx------ 1 rootroot rootroot 2488523424 12月 2 16:...
[tab](screenshot/tab.png) ![幻灯](screenshot/slide.png) ![图片水平滚动](screenshot/hscroll.png) ![毛玻璃效果](screenshot/blure.png) ![2000条数据搜索](screenshot/search.png) ![输入自动完成](screenshot/...
本文实例为大家分享了Android九宫格图片展示的具体代码,供大家参考,具体内容如下 先上html代码 <div id=test class=table-responsive xss=removed> <table id=resourceTable xss=removed class=table></table> ...