赞
踩
WindowManger的获取
mWindowManager = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams窗口布局参数设置
mBallWmParams = new WindowManager.LayoutParams();
mBallWmParams.type = WindowManager.LayoutParams.TYPE_PHONE;
mBallWmParams.flags|=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
mBallWmParams.gravity = Gravity.LEFT | Gravity.TOP;
mBallWmParams.x = sp.getInt(“ballWmParamsX”,0);
mBallWmParams.y = sp.getInt(“ballWmParamsY”,0);
mBallWmParams.width = FLOAT_BALL_SIZE;
mBallWmParams.height = FLOAT_BALL_SIZE;
mBallWmParams.format = PixelFormat.RGBA_8888;
WindowManger添加floatball的View
mWindowManager.addView(mBallView, mBallWmParams);
实现ActionBar.TabListener和ViewPager.OnPageChangeListener
设置ActionBar样式导航模式,并添加标题
mActionBar = getSupportActionBar();// 如果不使用Android Support Library, 则调用getActionBar()方法
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);// NAVIGATION_MODE_TABS常量表示Tab导航模式
mActionBar.setDisplayShowTitleEnabled(true);//显示标题
mTabs=new ArrayList<ActionBar.Tab>();
ActionBar.Tab tab0=mActionBar.newTab();
tab0.setText("基础设置");
tab0.setTabListener(this);
mTabs.add(tab0);
mActionBar.addTab(tab0);
viewList = new ArrayList<View>();
viewList.add(view_setup1);
viewList.add(view_setup2);
viewList.add(view_setup3);
viewList.add(view_setup4);
mViewPager = (ViewPager) findViewById(R.id.viewpager);
mViewPager.setAdapter(new MyPagerAdapter(viewList));
mViewPager.setOnPageChangeListener(this);
mViewPager.setCurrentItem(SETUP_BASE_ACTIVITY); //基础设置页面为首页
通过第三方获取的资源数据以Uri的形式返回,Uri由以下三部分组成: “content://”、数据的路径、标示ID(可选)
Uri imageUri = intent.getData();
FloatingBallUtils.bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageUri)
<menu xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!--要让item显示在actionbar上必须使用app:showAsAction 代替android:showAsAction-->
<item
android:id="@+id/action_clip"
app:showAsAction="always"
android:icon="@drawable/pic_ok"
android:title="设置" />
</menu>
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_func_key_setup, menu);
return true;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。