用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - android代码库

android腾讯微博客户端源码,功能基本齐全。

2014-04-30 作者: 啊伟举报

[android]代码库

package com.android.caigang.view;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RadioGroup;
import android.widget.TabHost;
import android.widget.TextView;

import com.android.caigang.R;

public class MainActivity extends TabActivity {
	private TabHost tabHost;
	private RadioGroup mainbtGroup;
	private static final String HOME = "主页";
	private static final String REFER = "提及";
	private static final String SECRET = "私信";
	private static final String SEARCH = "搜索";
	private static final String ATTENTIION = "关注";
	

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tabhost);
		
		tabHost = this.getTabHost();

		View view1 = View.inflate(MainActivity.this, R.layout.tab, null);
		((ImageView) view1.findViewById(R.id.tab_imageview_icon)).setImageResource(R.drawable.tab_timeline_selector);
		((TextView) view1.findViewById(R.id.tab_textview_title)).setText(HOME);

		TabHost.TabSpec spec1 = tabHost.newTabSpec(HOME)
				.setIndicator(view1)
				.setContent(new Intent(this, HomeTimeLineActivity.class));
		tabHost.addTab(spec1);
		
		View view2 = View.inflate(MainActivity.this, R.layout.tab, null);
		((ImageView) view2.findViewById(R.id.tab_imageview_icon)).setImageResource(R.drawable.tab_atme_selector);
		((TextView) view2.findViewById(R.id.tab_textview_title)).setText(REFER);

		TabHost.TabSpec spec2 = tabHost.newTabSpec(REFER)
				.setIndicator(view2)
				.setContent(new Intent(this, ReferActivity.class));
		tabHost.addTab(spec2);
		
		View view3 = View.inflate(MainActivity.this, R.layout.tab, null);
		((ImageView) view3.findViewById(R.id.tab_imageview_icon)).setImageResource(R.drawable.tab_message_selector);
		((TextView) view3.findViewById(R.id.tab_textview_title)).setText(SECRET);

		TabHost.TabSpec spec3 = tabHost.newTabSpec(SECRET)
				.setIndicator(view3)
				.setContent(new Intent(this, MessageActivity.class));
		tabHost.addTab(spec3);
		
		View view4 = View.inflate(MainActivity.this, R.layout.tab, null);
		((ImageView) view4.findViewById(R.id.tab_imageview_icon)).setImageResource(R.drawable.tab_explore_selector);
		((TextView) view4.findViewById(R.id.tab_textview_title)).setText(SEARCH);

		TabHost.TabSpec spec4 = tabHost.newTabSpec(SEARCH)
				.setIndicator(view4)
				.setContent(new Intent(this, SearchActivity.class));
		tabHost.addTab(spec4);
		
		View view5 = View.inflate(MainActivity.this, R.layout.tab, null);
		((ImageView) view5.findViewById(R.id.tab_imageview_icon)).setImageResource(R.drawable.tab_focus_selector);
		((TextView) view5.findViewById(R.id.tab_textview_title)).setText(ATTENTIION);

		TabHost.TabSpec spec5 = tabHost.newTabSpec(ATTENTIION)
				.setIndicator(view5)
				.setContent(new Intent(this, AttentionActivity.class));
		tabHost.addTab(spec5);
	}
}

[源代码打包下载]




网友评论    (发表评论)


发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...