0

Добрый день, Есть следующая проблема, есть поле 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());
}
2
  • Как вариант - поменяйте метами кнопку и инпутЛэйаут - так кнопка будет сверху последнего и он не будет её перекрыывать
    – ЮрийСПб
    14 мар 2017 в 16:32
  • @ЮрийСПб все гениальное просто.... Спасибо огромное.
    – norbertf
    14 мар 2017 в 16:35

1 ответ 1

1

Как вариант - поменяйте меcтами в разметке Button и TextInputLayout - так кнопка будет сверху последнего и он не будет её перекрывать

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.