android 常用代碼
作者:佚名
本文將講述android 常用代碼。希望這些代碼對各位的開發(fā)有所幫助。
<span style= "color: rgb(255, 0, 0);" > // 新建一個toast對象</span> private Toast toast; public void showMsg(String arg) { if (toast == null ) { toast = Toast.makeText( this , arg, Toast.LENGTH_SHORT); } else { toast.cancel(); toast.setText(arg); } toast.show(); } |
res/drawable目錄下面建立一個設(shè)置圓角邊框參數(shù)的xml文件,如下:
corner_round.xml:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#FFCC33" /> <corners android:radius="10dp" /> </shape>
調(diào)用:android:background="@drawable/corner_round"
【編輯推薦】
責(zé)任編輯:冰凝兒
來源:
博客園