Reputation: 135
why I can not see my chechbox ?
this is my screenshot of my layout :
I think it is due to my custom background ! Even if I change/remove the background does not affect!
why?!!!!!!!
How can I solve it?
layout :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/checkbox_amir_ghamsari"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:layout_marginRight="15dp"
android:background="#ffffff"
/>
<TextView
android:id="@+id/textview_amir_ghamsari"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/checkbox_amir_ghamsari"
android:layout_alignTop="@id/checkbox_amir_ghamsari"
android:text="@string/textview_amir_ghamsari"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textSize="@dimen/amir_masoud_size"
android:textColor="#ffffff"
android:layout_marginRight="15dp"
/>
<CheckBox
android:id="@+id/checkbox_s_masoud_emamian"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/checkbox_amir_ghamsari"
android:layout_alignParentRight="true"
android:layout_marginTop="30dp"
android:layout_marginRight="15dp"
android:background="#46462e"
/>
<TextView
android:id="@+id/textview_s_masoud_emamian"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/checkbox_s_masoud_emamian"
android:layout_alignTop="@id/checkbox_s_masoud_emamian"
android:text="@string/textview_s_masoud_emamian"
android:textStyle="bold"
android:textSize="@dimen/amir_masoud_size"
android:textColor="#ffffff"
android:layout_marginRight="15dp"
/>
<EditText
android:id="@+id/edittext_sms"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/edittext_hint_comments"
android:lines="5"
android:background="#46462e"
android:textColor="#ffffff"
android:layout_centerInParent="true"
/>
<ImageButton
android:id="@+id/imagebutton_send_sms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="@drawable/send_sms"
/>
</RelativeLayout>
Upvotes: 0
Views: 74
Reputation: 2641
Use this layout...
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/textview_amir_ghamsari"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="28dp"
android:text="amir_ghamsari" />
<CheckBox
android:id="@+id/checkbox_amir_ghamsari"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textview_amir_ghamsari"
android:layout_alignBottom="@+id/textview_amir_ghamsari"
android:layout_toRightOf="@+id/textview_amir_ghamsari" />
<TextView
android:id="@+id/textview_s_masoud_emamian"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/textview_amir_ghamsari"
android:layout_below="@+id/checkbox_amir_ghamsari"
android:layout_marginTop="22dp"
android:text="masoud_emamian" />
<CheckBox
android:id="@+id/checkbox_s_masoud_emamian"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textview_s_masoud_emamian"
android:layout_alignBottom="@+id/textview_s_masoud_emamian"
android:layout_alignLeft="@+id/checkbox_amir_ghamsari" />
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/checkbox_s_masoud_emamian"
android:layout_marginTop="120dp"
android:background="#46462e"
android:hint="hint_comments"
android:lines="5"
android:textColor="#ffffff" >
<requestFocus />
</EditText>
<ImageButton
android:id="@+id/imagebutton_send_sms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="@drawable/send_sms"
/>
</RelativeLayout>
Upvotes: 0
Reputation: 694
You can set drawable and check if its working or not. Check this link
Please check this blog.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:drawable="@drawable/check" />
<item android:state_checked="false"
android:drawable="@drawable/uncheck" />
</selector>
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CheckBox 1"
android:onClick="onCheckboxClicked"
android:button="@drawable/checkbox_selector" />
Upvotes: 1