TextInputLayout 내에 포함 된 EditText가 있습니다. EditText 아래에 오류를 표시하고 싶지만 화면의 오른쪽 끝으로 맞 춥니 다. 오류는 다음과 같이 표시됩니다 TextInputLayout 오른쪽 맞춤 오류
내 XML은 이것이다 :
이
내가 현재 가지고있는 것입니다 <android.support.design.widget.TextInputLayout
android:id="@+id/text_input_email"
style="@style/forgot_pass_text_inputlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tv_enter_email_message"
android:layout_marginTop="@dimen/email_padding_top"
android:hintTextAppearance="@{forgotPasswordVM.hintTextAppearance}"
android:theme="@style/forgot_pass_til_state"
app:error="@{forgotPasswordVM.email.textInputError}">
<EditText
android:id="@+id/actv_email"
style="@style/forgot_pass_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/email_address"
android:imeActionId="@+id/btn_submit"
android:imeOptions="actionSend"
android:inputType="textEmailAddress"
android:maxLines="1"
android:onEditorAction="@{forgotPasswordVM.onEditorAction}"
android:singleLine="true"
app:binding="@{forgotPasswordVM.email.text}" />
</android.support.design.widget.TextInputLayout>
저는 데이터 바인딩을 사용합니다.
EditText와 TextInputLayout 둘 다에서 android:gravity="right"
과 android:layout_gravity="right"
을 설정해 보았습니다. 둘 다 내가 원하는 방식으로 작동하지 않습니다.
나는 테마와 스타일에 올바른 중력을 설정해 보았습니다. 어느 쪽도 오류에 어떤 영향도 미치지 않습니다.
app:errorTextAppearance="@style/right_error"
에 적용되는 스타일에 올바른 중력을 시도했습니다. 심지어 이것은 작동하지 않습니다.
this link 다음에 나오는 AlignmentSpan과 함께 SpannableStringBuilder를 사용하여 프로그래밍 방식으로 오류를 오른쪽으로 시프트했습니다. 그것조차 저를 위해 작동하지 않는다.
나는 무엇을 시도해야할지 모르겠습니다. 제발 제안 해주세요.
[my answer here] (http://stackoverflow.com/a/40706872)의 옵션 중 하나를 사용하여 'TextView' 오류를 확인하고'setGravity (Gravity.RIGHT) '를 호출 할 수 있습니다 . 나는 그것을 테스트하지는 않았지만 IIRC, 오류 'TextView'는'match_parent' 너비가 있으므로 설명하는대로 텍스트를 정렬해야합니다. –