国内最全IT社区平台 联系我们 | 收藏本站
华晨云阿里云优惠2
您当前位置:首页 > 互联网 > Android源码之高仿爱奇艺

Android源码之高仿爱奇艺

来源:程序员人生   发布时间:2014-11-24 08:17:39 阅读次数:2977次
Android源码之高仿爱奇艺
根源码是1套UI界面,高仿的爱奇艺。没有实现具体功能。本项目默许编码 UTF⑻,需要的朋友可以拿去参考1下。
源码下载地址: http://url.cn/NLO3O4  










源码片断:

  1. public class MainActivity extends TabActivity implements OnClickListener {
  2.     public static String TAB_TAG_HOME = "home";
  3.     public static String TAB_TAG_CHANNEL = "channel";
  4.     public static String TAB_TAG_ACCOUNT = "account";
  5.     public static String TAB_TAG_SEARCH = "search";
  6.     public static String TAB_TAB_MORE = "more";
  7.     public static TabHost mTabHost;
  8.     static final int COLOR1 = Color.parseColor("#787878");
  9.     static final int COLOR2 = Color.parseColor("#ffffff");
  10.     ImageView mBut1, mBut2, mBut3, mBut4, mBut5;
  11.     TextView mCateText1, mCateText2, mCateText3, mCateText4, mCateText5;

  12.     Intent mHomeItent, mChannelIntent, mSearchIntent, mAccountIntent,
  13.             mMoreIntent;

  14.     int mCurTabId = R.id.channel1;

  15.     // Animation
  16.     private Animation left_in, left_out;
  17.     private Animation right_in, right_out;


  18.     /** Called when the activity is first created. */
  19.     @Override
  20.     public void onCreate(Bundle savedInstanceState) {
  21.         requestWindowFeature(Window.FEATURE_NO_TITLE);
  22.         super.onCreate(savedInstanceState);
  23.         setContentView(R.layout.main);
  24.         prepareAnim();
  25.         prepareIntent();
  26.         setupIntent();
  27.         prepareView();
  28.     }

  29.     private void prepareAnim() {
  30.         left_in = AnimationUtils.loadAnimation(this, R.anim.left_in);
  31.         left_out = AnimationUtils.loadAnimation(this, R.anim.left_out);

  32.         right_in = AnimationUtils.loadAnimation(this, R.anim.right_in);
  33.         right_out = AnimationUtils.loadAnimation(this, R.anim.right_out);
  34.     }

  35.     private void prepareView() {
  36.         mBut1 = (ImageView) findViewById(R.id.imageView1);
  37.         mBut2 = (ImageView) findViewById(R.id.imageView2);
  38.         mBut3 = (ImageView) findViewById(R.id.imageView3);
  39.         mBut4 = (ImageView) findViewById(R.id.imageView4);
  40.         mBut5 = (ImageView) findViewById(R.id.imageView5);
  41.         findViewById(R.id.channel1).setOnClickListener(this);
  42.         findViewById(R.id.channel2).setOnClickListener(this);
  43.         findViewById(R.id.channel3).setOnClickListener(this);
  44.         findViewById(R.id.channel4).setOnClickListener(this);
  45.         findViewById(R.id.channel5).setOnClickListener(this);
  46.         mCateText1 = (TextView) findViewById(R.id.textView1);
  47.         mCateText2 = (TextView) findViewById(R.id.textView2);
  48.         mCateText3 = (TextView) findViewById(R.id.textView3);
  49.         mCateText4 = (TextView) findViewById(R.id.textView4);
  50.         mCateText5 = (TextView) findViewById(R.id.textView5);
  51.     }

  52.     private void prepareIntent() {
  53.         mHomeItent = new Intent(this, HomeActivity.class);
  54.         mChannelIntent = new Intent(this, ChannelActivity.class);
  55.         mAccountIntent = new Intent(this, AccountActivity.class);
  56.         mSearchIntent = new Intent(this, SearchActivity.class);
  57.         mMoreIntent = new Intent(this, MoreActivity.class);
  58.     }

  59.     @Override
  60.     public boolean onKeyDown(int keyCode, KeyEvent event) {
  61.         // TODO Auto-generated method stub
  62.         if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
  63.             mBut1.performClick();
  64.             return true;
  65.         }
  66.         return super.onKeyDown(keyCode, event);
  67.     }

  68.     private void setupIntent() {
  69.         mTabHost = getTabHost();
  70.         mTabHost.addTab(buildTabSpec(TAB_TAG_HOME, R.string.category_home,
  71.                 R.drawable.icon_1_n, mHomeItent));
  72.         mTabHost.addTab(buildTabSpec(TAB_TAG_CHANNEL,
  73.                 R.string.category_channel, R.drawable.icon_2_n, mChannelIntent));
  74.         mTabHost.addTab(buildTabSpec(TAB_TAG_SEARCH, R.string.category_search,
  75. 生活不易,码农辛苦
    如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠
    程序员人生
------分隔线----------------------------
分享到:
------分隔线----------------------------
关闭
程序员人生