Android源码之高仿爱奇艺
根源码是1套UI界面,高仿的爱奇艺。没有实现具体功能。本项目默许编码 UTF⑻,需要的朋友可以拿去参考1下。
源码下载地址: http://url.cn/NLO3O4
源码片断:
-
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("#787878");
-
static final int COLOR2 = Color.parseColor("#ffffff");
-
ImageView mBut1, mBut2, mBut3, mBut4, mBut5;
-
TextView mCateText1, mCateText2, mCateText3, mCateText4, mCateText5;
-
-
Intent mHomeItent, mChannelIntent, mSearchIntent, mAccountIntent,
-
mMoreIntent;
-
-
int mCurTabId = R.id.channel1;
-
-
// 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() {
-
mHomeItent = new Intent(this, HomeActivity.class);
-
mChannelIntent = new Intent(this, ChannelActivity.class);
-
mAccountIntent = new Intent(this, AccountActivity.class);
-
mSearchIntent = new Intent(this, SearchActivity.class);
-
mMoreIntent = new Intent(this, MoreActivity.class);
-
}
-
-
@Override
-
public boolean onKeyDown(int keyCode, KeyEvent event) {
-
// TODO Auto-generated method stub
-
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
-
mBut1.performClick();
-
return true;
-
}
-
return super.onKeyDown(keyCode, event);
-
}
-
-
private void setupIntent() {
-
mTabHost = getTabHost();
-
mTabHost.addTab(buildTabSpec(TAB_TAG_HOME, R.string.category_home,
-
R.drawable.icon_1_n, mHomeItent));
-
mTabHost.addTab(buildTabSpec(TAB_TAG_CHANNEL,
-
R.string.category_channel, R.drawable.icon_2_n, mChannelIntent));
-
mTabHost.addTab(buildTabSpec(TAB_TAG_SEARCH, R.string.category_search,
-
------分隔线----------------------------
------分隔线----------------------------