2016-08-02 11 views
2

1.チェックボックスの色、チェックボックスの穴の色などを変更する方法に関する多くの質問/回答がありますが、チェックボックスの境界線(四角形の枠線)アンドロイドで画像を使わずにチェックボックスの枠線を増やす方法

<CheckBox 
     android:id="@+id/mChkAgree" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_margin="10dp" 
     android:buttonTint="@color/black" 
     android:scaleX="1.70" 
     android:scaleY="1.70" 
     android:text="@string/agree_text" 
     android:textColor="@color/black" 
     android:textSize="14sp" /> 

以下

私のチェックボックスのXMLコードは、今すぐチェックボックスの境界線は、正方形のチェックボックスの境界線(幅)を大きくするために、どのように

enter image description here

ほとんど見えませんか?

また、画像をチェックボックスに使用したくないので、カスタム画像を使用せずに可能ですか?この記事によると

答えて

0

:描画可能タグ:四角の枠線を増加させるためhttp://www.techrepublic.com/blog/software-engineer/create-a-custom-checkbox-in-your-android-app/

最良の方法は、カスタムアンドロイドでチェックボックスを使用しています。カスタム描画可能の

例(/ resを/ XMLフォルダに置く)

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle"> 
<stroke android:width="4px"/> 
<size android:height="20dp" android:width="20dp"/> 
</shape> 

そして...

<CheckBox 
    android:id="@+id/mChkAgree" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_margin="10dp" 
    android:buttonTint="@color/black" 
    android:scaleX="1.70" 
    android:scaleY="1.70" 
    android:text="@string/agree_text" 
    android:textColor="@color/black" 
    android:textSize="14sp" 
    android:drawable="@xml/custom_checkbox /> 
+1

どうもありがとう、しかし、あなたのソリューションともそのポストドン」内のソリューション仕事。そのリンクのソリューションが黒色で塗りつぶされている間は、ソリューションは効果がありません –

関連する問題