您好,欢迎光临本网站![请登录][注册会员]  
文件名称: csnd版android
  所属分类: Android
  开发工具:
  文件大小: 3mb
  下载次数: 0
  上传时间: 2015-07-12
  提 供 者: u0138*****
 详细说明: setContentView(R.layout.main); frameLayout = (FrameLayout) findViewById(R.id.dialogfram); (((ViewGroup) findViewById(android.R.id.content)).getChildAt(0)).setBackgroundColor(Color.parseColor("#ff121111")); // //hide the actionBar getActionBar().hide(); setupMenu(); cache = ACache.get(MainActivity.this); boolean isConn = NetUtil.checkNet(MainActivity.this); if (isConn) { // Log.i("ht","has conn========"); }else{ // Log.i("ht","no conn========"); FrameLayout frameLayout = (FrameLayout) findViewById(R.id.dialogfram); frameLayout.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { // TODO Auto-generated method stub return true; } }); frameLayout.setVisibility(View.VISIBLE); TextView textOk = (TextView) findViewById(R.id.dialogfram).findViewById(R.id.ok); TextView textCancel = (TextView) findViewById(R.id.dialogfram).findViewById(R.id.cancle); textOk.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // Log.d("html","====textOk====="); Intent intent = new Intent(Settings.ACTION_SETTINGS); startActivity(intent); findViewById(R.id.dialogfram).setVisibility(View.GONE); } }); textCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // Log.d("html","====textCancel====="); findViewById(R.id.dialogfram).setVisibility(View.GONE); } }); } sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); vibrator = (Vibrator) getSystemService(Service.VIBRATOR_SERVICE); changeFragment(new CloudFragment()); // ImageView imageShare = (ImageView) findViewById(R.id.action_bar_id).findViewById(R.id.share_image); imageShare.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { } }); } private void setupMenu(){ mResideMenu = new ResideMenu(this); mResideMenu.setBackground(R.drawable.menu_background);//设置北京图片 mResideMenu.attachToActivity(this); mResideMenu.setMenuListener(mMenuListener); mResideMenu.setScaleValue(0.4f); mMenu_name = getResources().getStringArray(R.array.menu_array); this.mMenu_cloud = new ResideMenuItem(this, R.drawable.mojitip_17, mMenu_name[0]); this.mMenu_mobile = new ResideMenuItem(this, R.drawable.mojitip_13, mMenu_name[1]); this.mMenu_industry = new ResideMenuItem(this, R.drawable.mojitip_14, mMenu_name[2]); this.mMenu_magzine = new ResideMenuItem(this, R.drawable.mojitip_15, mMenu_name[3]); this.mMenu_blog = new ResideMenuItem(this,R.drawable.mojitip_16,mMenu_name[4]); this.mMenu_save = new ResideMenuItem(this,R.drawable.mojitip_24,mMenu_name[5]); this.mMenu_settings = new ResideMenuItem(this,R.drawable.mojitip_26,mMenu_name[6]); this.mMenu_exit = new ResideMenuItem(this,R.drawable.exit,mMenu_name[7]); this.mMenu_cloud.setOnClickListener(this); this.mMenu_industry.setOnClickListener(this); this.mMenu_magzine.setOnClickListener(this); this.mMenu_mobile.setOnClickListener(this); this.mMenu_blog.setOnClickListener(this); this.mMenu_settings.setOnClickListener(this); this.mMenu_save.setOnClickListener(this); this.mMenu_exit.setOnClickListener(this); mResideMenu.addMenuItem(mMenu_cloud, ResideMenu.DIRECTION_LEFT); mResideMenu.addMenuItem(mMenu_mobile, ResideMenu.DIRECTION_LEFT); mResideMenu.addMenuItem(mMenu_industry, ResideMenu.DIRECTION_LEFT); mResideMenu.addMenuItem(mMenu_magzine, ResideMenu.DIRECTION_LEFT); mResideMenu.addMenuItem(mMenu_blog, ResideMenu.DIRECTION_LEFT); mResideMenu.addMenuItem(mMenu_save,ResideMenu.DIRECTION_LEFT); mResideMenu.addMenuItem(mMenu_settings,ResideMenu.DIRECTION_LEFT); mResideMenu.addMenuItem(mMenu_exit,ResideMenu.DIRECTION_LEFT); ImageView toggleIv = (ImageView) findViewById(R.id.openMenuBtn); //open menu toggleIv.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mResideMenu.openMenu(ResideMenu.DIRECTION_LEFT); } }); //set default title this.setActionBarTitle(mMenu_name[0]); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { return mResideMenu.dispatchTouchEvent(ev); } private ResideMenu.OnMenuListener mMenuListener = new ResideMenu.OnMenuListener() { @Override public void openMenu() { // Toast.makeText(MainActivity.this, "Menu is opened!", Toast.LENGTH_SHORT).show(); } @Override public void closeMenu() { // Toast.makeText(MainActivity.this, "Menu is closed!", Toast.LENGTH_SHORT).show(); } }; private void changeFragment(Fragment targetFragment){ frameLayout.setVisibility(View.GONE); mResideMenu.clearIgnoredViewList(); getSupportFragmentManager() .beginTransaction() .replace(R.id.main_fragment, targetFragment, "fragment") .setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .commit(); } /** * set title * @param title title name */ public void setActionBarTitle(String title){ TextView titleTv = (TextView) findViewById(R.id.title); titleTv.setText(title); System.out.println("title:"+titleTv.getText().toString()); } @Override public void onClick(View view) { if (view == mMenu_cloud){ setActionBarTitle(mMenu_name[0]); changeFragment(new CloudFragment()); }else if (view == mMenu_industry){ setActionBarTitle(mMenu_name[2]); changeFragment(new IndustryFragment()); }else if (view == mMenu_magzine){ setActionBarTitle(mMenu_name[3]); changeFragment(new Magzine()); }else if (view == mMenu_mobile){ setActionBarTitle(mMenu_name[1]); changeFragment(new Mobile()); }else if (view == mMenu_blog){ setActionBarTitle(mMenu_name[4]); changeFragment(new SoftDevFragment()); }else if (view == mMenu_settings){ setActionBarTitle(mMenu_name[6]); changeFragment(new SettingFragment()); }else if (view == mMenu_save) { setActionBarTitle(mMenu_name[5]); changeFragment(new MySaveFragment()); }else if (view == mMenu_exit) { TextView textTitle = (TextView) frameLayout.findViewById(R.id.title); TextView textSure = (TextView) frameLayout.findViewById(R.id.delete); TextView textOk = (TextView) frameLayout.findViewById(R.id.ok); TextView textCancel = (TextView) frameLayout.findViewById(R.id.cancle); textTitle.setText("确定退出"); textSure.setVisibility(View.GONE); frameLayout.setVisibility(View.VISIBLE); textOk.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { MainActivity.this.finish(); } }); textCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { frameLayout.setVisibility(View.GONE); } }); } ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: csdn
 输入关键字,在本站1000多万海量源码库中尽情搜索: