Android自定義radiobutton(文字靠左,選框靠右)


  1. <RadioButton  
  2.             android:id="@+id/rb_never"  
  3.             android:layout_width="fill_parent"  
  4.             android:layout_height="wrap_content"  
  5.             android:background="@android:color/transparent"  
  6.             android:button="@null"  
  7.             android:checked="true"  
  8.             android:drawableRight="@android:drawable/btn_radio"  
  9.             android:paddingLeft="5dip"  
  10.             android:text="never" />  

 

關鍵的句子是:

android:button="@null" 刪除原本系統默認在左的選擇框

android:background="@android:color/transparent"  去除左邊選擇框被刪除后的空白

android:drawableRight="@android:drawable/btn_radio"  選擇框繪制在右


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM