For me, none of the answers led to a fully working solution.
Showcase of my fix https://www.youtube.com/watch?v=oUA4Cuxfdqc
Guide (noob friendly) , pay attention to a few comments in the code.
Create a Java class for a custom EditText called EditTextDispatched.java
import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.RelativeLayout; public class EditTextDispatched extends android.support.v7.widget.AppCompatEditText { private static final String TAG = "DispatchingEditText"; private boolean editable = true; public EditTextDispatched(Context context) { super(context); } public EditTextDispatched(Context context, AttributeSet attrs) { super(context, attrs); } public EditTextDispatched(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); }
Link EditTextDispatched to your xml (you will need to change the name pgk):
<io.celox.brutus.EditTextDispatched android:id="@+id/row_field_value" style="@style/row_field_text_display" android:layout_alignParentBottom="true" android:text="@string/sample_field_value" />
To call:
private void changeEditTextBehaviour(EditTextDispatched value, boolean editable) { value.setEditable(editable); value.setEnabled(editable); }
Martin Pfeffer Mar 26 '17 at 10:52 on 2017-03-26 10:52
source share