1.在/res/drawable/加入圖片checked.png與unchecked.png
2./res/drawable/bottom.xml
3./res/layout/main.xml
android:button="@android:color/transparent" ----- 隱藏原核取方塊
android:drawableTop="@drawable/bottom" ----- 加入選擇器bottom.xml,文字在下方
android:drawableLeft ----- 文字在右方
android:drawableRight ----- 文字在左方
android:drawableBottom ----- 文字在上方
4.Main.java
package tw.android; import android.app.Activity; import android.os.Bundle; public class Main extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }
參考來源:
http://stackoverflow.com/questions/27030629/android-how-to-align-the-checkbox-text-in-the-bottom
http://stackoverflow.com/questions/16063135/removing-the-box-from-the-checkbox-in-android
沒有留言 :
張貼留言