首页

android 仿网易客户端 底部切换tab签

java

2020-6-30


import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.RelativeLayout;
import android.widget.TabHost;

import com.and.netease.utils.MoveBg;

@SuppressWarnings("deprecation")
public class MainActivity extends TabActivity {
TabHost tabHost;
TabHost.TabSpec tabSpec;
RadioGroup radioGroup;
RelativeLayout bottom_layout;
ImageView img;
int startLeft;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

bottom_layout = (RelativeLayout) findViewById(R.id.layout_bottom);

tabHost = getTabHost();
tabHost.addTab(tabHost.newTabSpec("news").setIndicator("News")
.setContent(new Intent(this, TabNewsActivity.class)));
tabHost.addTab(tabHost.newTabSpec("topic").setIndicator("Topic")
.setContent(new Intent(this, TabTopicActivity.class)));
tabHost.addTab(tabHost.newTabSpec("picture").setIndicator("Picture")
.setContent(new Intent(this, TabPicActivity.class)));
tabHost.addTab(tabHost.newTabSpec("follow").setIndicator("Follow")
.setContent(new Intent(this, TabFollowActivity.class)));
tabHost.addTab(tabHost.newTabSpec("vote").setIndicator("Vote")
.setContent(new Intent(this, TabVoteActivity.class)));

radioGroup = (RadioGroup) findViewById(R.id.radiogroup);
radioGroup.setOnCheckedChangeListener(checkedChangeListener);

img = new ImageView(this);
img.setImageResource(R.drawable.tab_front_bg);
bottom_layout.addView(img);
}

private OnCheckedChangeListener checkedChangeListener = new OnCheckedChangeListener() {

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.radio_news:
tabHost.setCurrentTabByTag("news");
MoveBg.moveFrontBg(img, startLeft, 0, 0, 0);
startLeft = 0;
break;
case R.id.radio_topic:
tabHost.setCurrentTabByTag("topic");
MoveBg.moveFrontBg(img, startLeft, img.getWidth(), 0, 0);
startLeft = img.getWidth();
break;
case R.id.radio_pic:
tabHost.setCurrentTabByTag("picture");
MoveBg.moveFrontBg(img, startLeft, img.getWidth() * 2, 0, 0);
startLeft = img.getWidth() * 2;
break;
case R.id.radio_follow:
tabHost.setCurrentTabByTag("follow");
MoveBg.moveFrontBg(img, startLeft, img.getWidth() * 3, 0, 0);
startLeft = img.getWidth() * 3;
break;
case R.id.radio_vote:
tabHost.setCurrentTabByTag("vote");
MoveBg.moveFrontBg(img, startLeft, img.getWidth() * 4, 0, 0);
startLeft = img.getWidth() * 4;
break;

default:
break;
}
}
};
}

资源下载此资源下载价格为3D币(VIP免费),请先
资源文件列表
高仿网易客户端UI(tabhost) - 副本/netease_news/.classpath , 475
高仿网易客户端UI(tabhost) - 副本/netease_news/.project , 845
高仿网易客户端UI(tabhost) - 副本/netease_news/.settings/org.eclipse.jdt.core.prefs , 177
高仿网易客户端UI(tabhost) - 副本/netease_news/AndroidManifest.xml , 1091
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/AndroidManifest.xml , 1091
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/A_DB.apk , 97385
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/BuildConfig.class , 339
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/MainActivity$1.class , 1653
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/MainActivity.class , 2677
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/R$attr.class , 331
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/R$drawable.class , 1169
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/R$id.class , 984
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/R$layout.class , 566
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/R$string.class , 929
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/R.class , 510
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/TabFollowActivity.class , 526
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/TabNewsActivity$1.class , 1599
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/TabNewsActivity.class , 2331
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/TabPicActivity.class , 517
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/TabTopicActivity.class , 523
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/TabVoteActivity.class , 520
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes/com/and/netease/utils/MoveBg.class , 833
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/classes.dex , 10480
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/jarlist.cache , 120
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/NetEaseUI.apk , 97372
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/netease_news.apk , 97256
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/back_comment_tab.png , 675
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/back_news_tab.png , 621
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/back_picture_tab.png , 555
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/back_topic_tab.png , 614
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/back_vote_tab.png , 602
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/bottombg.png , 212
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/current_comment_tab.png , 1464
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/current_news_tab.png , 1378
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/current_picture_tab.png , 1287
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/current_topic_tab.png , 1376
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/current_vote_tab.png , 1388
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/duoyun.png , 23153
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/ic_launcher.png , 9193
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/netease_top.png , 5627
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/slidebar.png , 1174
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-hdpi/tab_front_bg.png , 2546
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-ldpi/ic_launcher.png , 2658
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-mdpi/ic_launcher.png , 5057
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/res/drawable-xhdpi/ic_launcher.png , 14068
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/resources.ap_ , 88983
高仿网易客户端UI(tabhost) - 副本/netease_news/bin/Test.apk , 97231
高仿网易客户端UI(tabhost) - 副本/netease_news/gen/com/and/netease/BuildConfig.java , 157
高仿网易客户端UI(tabhost) - 副本/netease_news/gen/com/and/netease/R.java , 3999
高仿网易客户端UI(tabhost) - 副本/netease_news/proguard-project.txt , 781
高仿网易客户端UI(tabhost) - 副本/netease_news/project.properties , 563
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable/tab_selector_follow.xml , 306
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable/tab_selector_news.xml , 300
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable/tab_selector_pic.xml , 306
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable/tab_selector_topic.xml , 302
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable/tab_selector_vote.xml , 300
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/back_comment_tab.png , 675
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/back_news_tab.png , 621
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/back_picture_tab.png , 555
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/back_topic_tab.png , 614
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/back_vote_tab.png , 602
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/bottombg.png , 212
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/current_comment_tab.png , 1464
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/current_news_tab.png , 1378
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/current_picture_tab.png , 1287
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/current_topic_tab.png , 1376
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/current_vote_tab.png , 1388
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/duoyun.png , 23153
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/ic_launcher.png , 9397
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/netease_top.png , 5627
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/slidebar.png , 1174
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-hdpi/tab_front_bg.png , 2546
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-ldpi/ic_launcher.png , 2729
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-mdpi/ic_launcher.png , 5237
高仿网易客户端UI(tabhost) - 副本/netease_news/res/drawable-xhdpi/ic_launcher.png , 14383
高仿网易客户端UI(tabhost) - 副本/netease_news/res/layout/layout_follow.xml , 1253
高仿网易客户端UI(tabhost) - 副本/netease_news/res/layout/layout_news.xml , 5198
高仿网易客户端UI(tabhost) - 副本/netease_news/res/layout/layout_picture.xml , 1158
高仿网易客户端UI(tabhost) - 副本/netease_news/res/layout/layout_topic.xml , 1156
高仿网易客户端UI(tabhost) - 副本/netease_news/res/layout/layout_vote.xml , 1155
高仿网易客户端UI(tabhost) - 副本/netease_news/res/layout/main.xml , 3191
高仿网易客户端UI(tabhost) - 副本/netease_news/res/values/strings.xml , 870
高仿网易客户端UI(tabhost) - 副本/netease_news/src/com/and/netease/MainActivity.java , 2749
高仿网易客户端UI(tabhost) - 副本/netease_news/src/com/and/netease/TabFollowActivity.java , 371
高仿网易客户端UI(tabhost) - 副本/netease_news/src/com/and/netease/TabNewsActivity.java , 3592
高仿网易客户端UI(tabhost) - 副本/netease_news/src/com/and/netease/TabPicActivity.java , 332
高仿网易客户端UI(tabhost) - 副本/netease_news/src/com/and/netease/TabTopicActivity.java , 369
高仿网易客户端UI(tabhost) - 副本/netease_news/src/com/and/netease/TabVoteActivity.java , 367
高仿网易客户端UI(tabhost) - 副本/netease_news/src/com/and/netease/utils/MoveBg.java , 640
没有账号? 忘记密码?

社交账号快速登录