Android View is still getting OnClick() even by set its visibility to GONE -


i know there few questions regard issue of them using animation. have no animation @ in activity. have textview default visible , set gone based on feature-flag in splash screen.

this xml file:

<framelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/profile_layout"     android:layout_width="match_parent"     android:layout_height="match_parent">      <linearlayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:background="@drawable/profile_bg"         android:gravity="center_horizontal"         android:orientation="vertical"         android:paddingtop="?android:actionbarsize">      <textview             android:id="@+id/payments_btn"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_margin="6dp"             android:background="@drawable/profile_payment_bg"             android:clickable="true"             android:drawableleft="@drawable/ic_profile_payment"             android:drawablepadding="8dp"             android:gravity="center_vertical"             android:onclick="onclick"             android:padding="8dp"             android:text="payment"             android:textappearance="?android:textappearancemedium"             android:textcolor="@android:color/white" />  ...      </linearlayout>  </framelayout> 

although i'm setting clickable , onclicklistener functionality false , null respectively, onclick() functionality called when payment button not visible :(

@override     protected void oncreate(final bundle savedinstancestate)     {         super.oncreate(savedinstancestate);         this.setcontentview(r.layout.activity_profile);          this.mpayments = (textview) findviewbyid(r.id.payments_btn);          // check if payment functionality available passenger         final passengerfeatureresponse cachedfeature = featureresponse.fromjsonstring(preferenceutils.getfeatureresponse(this));         if (cachedfeature == null || !cachedfeature.ismade())         {             this.mpayments.setvisibility(view.gone);             this.mpayments.setclickable(false);             this.mpayments.setonclicklistener(null);         }     } 

i tried set visibility gone xml file , set visible code functionality same :(

it's because have defined onclick functionality xml file , problem fixed if set click listener code, however, i'm looking fix issue in way.

any suggestion appreciated. thanks.

try on framelayout this

  this.framemain= (framelayout) findviewbyid(r.id.profile_layout);        if (cachedfeature == null || !cachedfeature.ismade())         {             this.mpayments.setvisibility(view.gone);             this.mpayments.setclickable(false);             this.mpayments.setonclicklistener(null);             this.framemain.invalidate();         } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -