Добрый день,
Есть следующая проблема, есть поле edit text
и button
которые накладываются друг на друга, не могу отловить onclicklistner
у кнопки, т.к. его перехватывает edittext.
Пробовал перехватить на кнопке
ontouch` но что-то тоже безрезультатно.
Внешне должно выглядеть вот так:
Буду благодарен за помощь.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:layout_marginRight="@dimen/default_padding"
android:layout_marginLeft="@dimen/default_padding">
<Button
android:id="@+id/resend_sms_hint_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:buttonBarButtonStyle"
android:text="@string/not_receive_sms"
android:layout_alignParentRight="true"
android:gravity="bottom"
android:textAllCaps="false"/>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_code_editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/auth_code"
android:maxLines="1"
android:maxLength="4"
android:inputType="textPassword"
android:textAllCaps="true"
android:imeActionId="@+id/continue_SMS_login"
android:imeOptions="actionUnspecified"/>
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
Код:
private void initializeUI() {
mInputCodeEditText.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == R.id.continue_SMS_login || actionId == EditorInfo.IME_NULL) {
attemptLogin();
return true;
}
return false;
});
mResendSMSHintButton.setOnTouchListener((v, event) -> {
resendSMS();
return true;
});
mResendSMSHintButton.setOnClickListener(l -> {
resendSMS();
});
mContinueButton.setOnClickListener(l -> attemptLogin());
}