摘要:
// 获取当前应用应用名public static String getAppName(Context context) { return context.getApplicationInfo().loadLabel(context.getPackageManager()).toString();}// 获取当前应用版本名public static String getVersionName(Context context) {try { return context.getPackageManager().getPackageInfo(context.getPackageName(),... 阅读全文
摘要:
1.设置全屏 在Activity的onCreate方法中的setContentView(myview)调用之前添加下面代码,可实现全屏 requestWindowFeature(Window.FEATURE_NO_TITLE);//隐藏标题栏 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//设置全屏2.设置横屏两种方式: 1.重写onResume()方法 protected void onResume... 阅读全文
摘要:
两种情况 1.控件外层父控件为LinearLayout topRightLayout.setLayoutParams(new LinearLayout.LayoutParams((int) (getDisplayWidth(this) * 0.8), LayoutParams.FILL_PARENT)); 1.控件外层父控件为RelativeLayout topRightLayout.setLayoutParams(newRelativeLayout.LayoutParams((int) (getDisplayWidth(this) * 0.8), LayoutParams.F... 阅读全文
摘要:
publicclassCountdownextendsActivity{privateinttime = 30; //初始化时间publicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.countdown);handler.postDelayed(runnable,1000);}Handlerhandler=newHandler();Runnablerunnable=newRunnable(){@Overridepublicvoidrun(){ 阅读全文