标签:click rate use alt name app top cat class
1.计时器(Chronometer)
<!-- 给应用授权:改变震动的权限 -->
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
//取得震动服务
vb=(Vibrator) getApplication().getSystemService(Service.VIBRATOR_SERVICE);
//开始计时
bstart.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ch.start();
vb.vibrate(new long[]{1000,1000,1000,2000}
, 0);
}
});
//停止计时
bstop.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ch.stop();
ch.setBase(SystemClock.elapsedRealtime());//复原
}
});
2.标签组件(TabHost)
TabHost tabHost=getTabHost();
//把内容XML绑定在tabhost中
LayoutInflater.from(this).inflate(R.layout.tabhost
, tabHost.getTabContentView(),true);
TabSpec ts1=tabHost.newTabSpec("tab1")
.setIndicator("选项一")
.setContent(R.id.tv011);
tabHost.addTab(ts1);
TabSpec ts2=tabHost.newTabSpec("tab2")
.setIndicator("选项二")
.setContent(R.id.tv022);
tabHost.addTab(ts2);
TabSpec ts3=tabHost.newTabSpec("tab3")
.setIndicator("选项三")
.setContent(R.id.tv033);
tabHost.addTab(ts3);
标签:click rate use alt name app top cat class
原文地址:http://www.cnblogs.com/hangekgmx/p/6905104.html