DevStore首页 > DEV资源 > 源码下载 > 源码详情

仿微米网Android客户端全部UI

 
anitbird | 2014-09-27 17:15    浏览量(13497)    评论(63)    收藏(35)
功能分类:社交 支持平台:Android 运行环境:Eclipse
开发语言:Java 开发工具:Eclipse 源码大小:19.60MB
下载源码 3370 人下载

源码简介

仿微米网Android客户端全部UI

源码截图

  • 首页
  • 群组
  • 微米圈
  • 联系人
  • 个人中心
  • 圈子
  • 圈子资料
  • 二维码
  • 发布
  • 发布
DevStore所有源码来自用户上传分享,版权问题及牵扯到商业纠纷均与DevStore无关。

源码片段

public class MainActivity extends TabActivity implements OnClickListener {
	public static String TAB_TAG_HOME = "home";
	public static String TAB_TAG_CHANNEL = "channel";
	public static String TAB_TAG_ACCOUNT = "account";
	public static String TAB_TAG_SEARCH = "search";
	public static String TAB_TAB_MORE = "more";
	public static TabHost mTabHost;
	static final int COLOR1 = Color.parseColor("#838992");
	static final int COLOR2 = Color.parseColor("#b87721");
	ImageView mBut1, mBut2, mBut3, mBut4, mBut5;
	TextView mCateText1, mCateText2, mCateText3, mCateText4, mCateText5;

	Intent mshouyeIntent, mHomeItent, mChannelIntent, mSearchIntent,
			mMoreIntent;

	int mCurTabId = R.id.channel3;

	// Animation
	private Animation left_in, left_out;
	private Animation right_in, right_out;

	/** Called when the activity is first created. */

	@Override
	public void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		prepareAnim();
		prepareIntent();
		setupIntent();
		prepareView();

	}

	private void prepareAnim() {
		left_in = AnimationUtils.loadAnimation(this, R.anim.left_in);
		left_out = AnimationUtils.loadAnimation(this, R.anim.left_out);
		right_in = AnimationUtils.loadAnimation(this, R.anim.right_in);
		right_out = AnimationUtils.loadAnimation(this, R.anim.right_out);
	}

	private void prepareView() {
		mBut1 = (ImageView) findViewById(R.id.imageView1);
		mBut2 = (ImageView) findViewById(R.id.imageView2);
		mBut3 = (ImageView) findViewById(R.id.imageView3);
		mBut4 = (ImageView) findViewById(R.id.imageView4);
		mBut5 = (ImageView) findViewById(R.id.imageView5);
		findViewById(R.id.channel1).setOnClickListener(this);
		findViewById(R.id.channel2).setOnClickListener(this);
		findViewById(R.id.channel3).setOnClickListener(this);
		findViewById(R.id.channel4).setOnClickListener(this);
		findViewById(R.id.channel5).setOnClickListener(this);
		mCateText1 = (TextView) findViewById(R.id.textView1);
		mCateText2 = (TextView) findViewById(R.id.textView2);
		mCateText3 = (TextView) findViewById(R.id.textView3);
		mCateText4 = (TextView) findViewById(R.id.textView4);
		mCateText5 = (TextView) findViewById(R.id.textView5);

	}

	private void prepareIntent() {

		mshouyeIntent = new Intent(this, InfoActivity.class);

		mHomeItent = new Intent(this, MimeGroupActivity.class);

		mChannelIntent = new Intent(this, MimeWeiCircle.class);

		mSearchIntent = new Intent(this, ContactsActivity.class);

		mMoreIntent = new Intent(this, MimePageActivity.class);

	}

	private void setupIntent() {

		mTabHost = getTabHost();

		mTabHost.addTab(buildTabSpec(TAB_TAG_SEARCH, R.string.bottomtitle01,
				R.drawable.shouyemain1, mshouyeIntent));

		mTabHost.addTab(buildTabSpec(TAB_TAG_HOME, R.string.bottomtitle02,
				R.drawable.shouyemain1, mHomeItent));

		mTabHost.addTab(buildTabSpec(TAB_TAG_CHANNEL, R.string.bottomtitle03,
				R.drawable.msg1, mChannelIntent));

		mTabHost.addTab(buildTabSpec(TAB_TAG_ACCOUNT, R.string.bottomtitle04,
				R.drawable.help1, mSearchIntent));

		mTabHost.addTab(buildTabSpec(TAB_TAB_MORE, R.string.bottomtitle05,
				R.drawable.mimetab1, mMoreIntent));
	}

	private TabHost.TabSpec buildTabSpec(String tag, int resLabel, int resIcon,
			final Intent content) {
		return mTabHost
				.newTabSpec(tag)
				.setIndicator(getString(resLabel),
						getResources().getDrawable(resIcon))
				.setContent(content);
	}

	public static void setCurrentTabByTag(String tab) {
		mTabHost.setCurrentTabByTag(tab);
	}

	@Override
	public void onClick(View v) {

		// TODO Auto-generated method stub
		if (mCurTabId == v.getId()) {

			return;
		}

		mBut3.setImageResource(R.drawable.shouyemain1);
		mBut1.setImageResource(R.drawable.msg1);
		mBut2.setImageResource(R.drawable.mimetab1);
		mBut4.setImageResource(R.drawable.help1);
		mBut5.setImageResource(R.drawable.mime1);
		mCateText1.setTextColor(COLOR1);
		mCateText2.setTextColor(COLOR1);
		mCateText3.setTextColor(COLOR1);
		mCateText4.setTextColor(COLOR1);
		mCateText5.setTextColor(COLOR1);
		int checkedId = v.getId();
		final boolean o;
		if (mCurTabId < checkedId)
			o = true;
		else
			o = false;
		if (o)
			mTabHost.getCurrentView().startAnimation(left_out);
		else
			mTabHost.getCurrentView().startAnimation(right_out);
		switch (checkedId) {

		case R.id.channel3:
			mTabHost.setCurrentTabByTag(TAB_TAG_SEARCH);
			mBut3.setImageResource(R.drawable.shouyemain);
			mCateText3.setTextColor(COLOR2);

			break;

		case R.id.channel1:
			mTabHost.setCurrentTabByTag(TAB_TAG_HOME);
			mBut1.setImageResource(R.drawable.msg);
			mCateText1.setTextColor(COLOR2);

			break;
		case R.id.channel2:
			mTabHost.setCurrentTabByTag(TAB_TAG_CHANNEL);
			mBut2.setImageResource(R.drawable.mimetab);
			mCateText2.setTextColor(COLOR2);

			break;

		case R.id.channel4:
			mTabHost.setCurrentTabByTag(TAB_TAG_ACCOUNT);
			mBut4.setImageResource(R.drawable.help);
			mCateText4.setTextColor(COLOR2);

			break;
		case R.id.channel5:
			mTabHost.setCurrentTabByTag(TAB_TAB_MORE);
			mBut5.setImageResource(R.drawable.mime);
			mCateText5.setTextColor(COLOR2);

			break;
		default:
			break;
		}

		if (o)
			mTabHost.getCurrentView().startAnimation(left_in);
		else
			mTabHost.getCurrentView().startAnimation(right_in);
		mCurTabId = checkedId;
	}

}
  •   赞(6) 赞 +1 赞(6) 已赞
  •   收藏(35) 收藏 +1 已收藏 取消
  •   下载(3370)
评论(63)
四道风尘

四道风尘 2017-10-26 15:37:07

谢谢分享,准备好好学习android开发了
回复(0) 赞(0) 赞(1)
微小刺刀

微小刺刀 2016-11-03 23:20:38

微达微信源码免费下载 正版商用


链接: http://pan.baidu.com/s/1pKMKX8R 密码: k4en
回复(0) 赞(0) 赞(1)
羞色的师爷

羞色的师爷 2016-10-25 16:36:25

代码比较完整,界面对学习ui很有参考性,感谢楼主。
回复(0) 赞(0) 赞(1)
agag3344

agag3344 2016-08-12 07:42:56

学习ui开发
谢谢
回复(0) 赞(0) 赞(1)
854632614

854632614 2016-04-27 11:21:32

谢分享,赞一个,嘻嘻
回复(0) 赞(0) 赞(1)
  • 推荐
  • 审核
  • 收录
  • 获取活力值

源码上传作者

  • 32 能力值
  • 16 源码
  • 0 评测
  • 1 资料

热门源码