摘要:Give your activity's root view a known ID, say '@+id/activityRoot', hook a GlobalLayoutListener into the ViewTreeObserver, and from there calculate the size diff between your activity's view root and the window size:final View activityRootView = findViewById(R.id.activityRoot);activi
阅读全文
摘要:1 private void setWinWidth() {2 DisplayMetrics metric = new DisplayMetrics();3 getWindowManager().getDefaultDisplay().getMetrics(metric);4 LayoutParams p = getWindow().getAttributes();5 p.width = (int) (metric.widthPixels * 0.8);6 getWindow().setAttributes...
阅读全文
摘要:1 private void goToMarket(String packageName) { 2 try { 3 Intent intent = new Intent(Intent.ACTION_VIEW); 4 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 5 intent.setData(Uri.parse("market://details?id=" + packageName)); 6 startActivity(...
阅读全文
摘要:启动一个Intent发邮件,指定receiver email, subject, body: 1 /** 2 * Start an activity to send an email to the given receiver, with the given subject and text body. 3 * @param receiver The receiver's email address 4 * @param subject Email subject. 5 * @param text Email body. 6 */ 7 ...
阅读全文