material
material copied to clipboard
CheckBox clickability
I'm using <com.rey.material.widget.CheckBox android:id="@android:id/checkbox" style="@style/Material.Drawable.CheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="16dip" android:clickable="false" android:focusable="false" android:focusableInTouchMode="false" app:cbd_boxSize="18dp"/>
in a custom layout for checkboxpreference. And the checkbox widget still clickable!!. Any idea?
Pls try to set android:enabled="false"
.
I just tried and it doesn't work. Help?
Can you please provide all the xml and code you used?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingRight="?android:attr/scrollbarSize">
<com.rey.material.widget.CheckBox
android:id="@android:id/checkbox"
style="@style/Material.Drawable.CheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dip"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
app:cbd_boxSize="18dp" />
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginBottom="6dip"
android:layout_marginRight="16dip"
android:layout_marginTop="6dip"
android:layout_weight="1"
android:gravity="end">
<TextView
android:id="@+android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:text="Title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary" />
<TextView
android:id="@android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@android:id/title"
android:layout_below="@android:id/title"
android:maxLines="3"
android:text="subTitle"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary" />
</RelativeLayout>
And in the prefs.xml
<CheckBoxPreference
android:defaultValue="true"
android:key="time12"
android:layout="@layout/checkboxpreference_layout"
android:summaryOff="@string/_13"
android:summaryOn="@string/_01"
android:title="@string/_12Format" />
Just curious, do you want to replace the layout of entire Preference, or just the layout of controllable widget portion in this Preference? And why you want to disable checkbox when CheckBoxPreference is for selecting option?
Yes I have to replace the whole layout not only the widget. I want the user to check/uncheck the checkBox by clicking on the whole preference. Right now, when I click on the preference every thing works great, but when click on the checkBox itself it doesn't register the checkedChengeListener at all. you got it?
Any help?
"com.rey.material.widget.CheckBox cannot be cast to android.widget.CheckBox "
how i can solve this error in java code this error is appear please help
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by: java.lang.ClassCastException: com.rey.material.widget.CheckBox cannot be cast to android.widget.CheckBox at com.teamtreehouse.ecomerce.SigninActivity.onCreate(SigninActivity.java:43) at android.app.Activity.performCreate(Activity.java:6876) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) at android.app.ActivityThread.access$1100(ActivityThread.java:221) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7224) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
I used just CheckBox instead com.rey.material.widget.CheckBox. It helps me
"com.rey.material.widget.CheckBox cannot be cast to android.widget.CheckBox " how i can solve this error in java code this error is appear please help
Hello, I am facing the same problem pls help me if u have the solution for this . Thankyou!
Basically you are trying to cast com.rey.materil.widget.CheckBox to android.widget.CheckBox which throws error makes our application to stop suddenly. solution : private com.rey.material.widget.CheckBox chkBoxRememberMe; use the above line while iniatilising your check box and if it shows error later that press alt+enter and import it to com.rey.material.widget.checkBox
thats it . It works for me even i was facing the same issue.
Ok thanks
On Fri, Nov 1, 2019, 3:32 AM arpitjain1996 [email protected] wrote:
Basically you are trying to cast com.rey.materil.widget.CheckBox to android.widget.CheckBox which throws error makes our application to stop suddenly. solution : private com.rey.material.widget.CheckBox chkBoxRememberMe; use the above line while iniatilising your check box and if it shows error later that press alt+enter and import it to com.rey.material.widget.checkBox
thats it . It works for me even i was facing the same issue.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rey5137/material/issues/125?email_source=notifications&email_token=ALWSHVPNVYRH25EAWGXV3PDQRNMINA5CNFSM4BERIUO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECZOL2Q#issuecomment-548595178, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALWSHVJD7PZL3XOELLDSOSDQRNMINANCNFSM4BERIUOQ .
Ok thanks … On Fri, Nov 1, 2019, 3:32 AM arpitjain1996 @.***> wrote: Basically you are trying to cast com.rey.materil.widget.CheckBox to android.widget.CheckBox which throws error makes our application to stop suddenly. solution : private com.rey.material.widget.CheckBox chkBoxRememberMe; use the above line while iniatilising your check box and if it shows error later that press alt+enter and import it to com.rey.material.widget.checkBox thats it . It works for me even i was facing the same issue. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#125?email_source=notifications&email_token=ALWSHVPNVYRH25EAWGXV3PDQRNMINA5CNFSM4BERIUO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECZOL2Q#issuecomment-548595178>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALWSHVJD7PZL3XOELLDSOSDQRNMINANCNFSM4BERIUOQ .
Also make sure that u use ur own variable name . Dont just copy as mentioned in my solution. Also reply if my solutions works for you
Don't import android.widget.CheckBox .. but you should import com.rey.material.widget.CheckBox;
I used just CheckBox instead com.rey.material.widget.CheckBox. It helps me
@DGani thanks
Basically you are trying to cast com.rey.materil.widget.CheckBox to android.widget.CheckBox which throws error makes our application to stop suddenly. solution : private com.rey.material.widget.CheckBox chkBoxRememberMe; use the above line while iniatilising your check box and if it shows error later that press alt+enter and import it to com.rey.material.widget.checkBox
thats it . It works for me even i was facing the same issue.
It works for me.Thank you :)
Thanks i know that ..
On Fri, Mar 13, 2020, 11:58 AM syedahmed636 [email protected] wrote:
Basically you are trying to cast com.rey.materil.widget.CheckBox to android.widget.CheckBox which throws error makes our application to stop suddenly. solution : private com.rey.material.widget.CheckBox chkBoxRememberMe; use the above line while iniatilising your check box and if it shows error later that press alt+enter and import it to com.rey.material.widget.checkBox
thats it . It works for me even i was facing the same issue.
It works for me.Thank you :)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rey5137/material/issues/125#issuecomment-598642702, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVVFMULLNKNRE4JHLO4JVTRHH7UZANCNFSM4BERIUOQ .