を呼び出すときにエラーEditText
のエラーインジケータの位置に問題があります。EditText setErrorがBottomSheetDialog内で外れています
スクリーンショットからわかるように、BottomSheetDialog
にはEditText
を使用しています。エラーインジケータを表示すると、テキストは完全にはずれてしまいます。それは実際にはないのですが、ダイアログがフルスクリーンであると「考えている」ように見えます。
これは私のダイアログレイアウトファイル(phone_dialog.xml)である:これは私が示した方法です
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/rvContacts"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="vertical">
<TextView
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:padding="@dimen/padding_layout_normal"
android:text="@string/dialog_title_edit_phone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<EditText
android:id="@+id/etPhone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:inputType="phone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvTitle"/>
<Button
android:id="@+id/btnSavePhone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/etPhone"/>
</android.support.constraint.ConstraintLayout>
マイActivity
レイアウトファイル(activity_contacts.xml)私からのダイアログActivity
:
PhoneBottomDialog dialog = new PhoneBottomDialog(Context);
dialog.show();
これは私のPhoneBottomDialog
クラスである:私は私のカスタムPhoneButtomDialog
内の他のレイアウト機能を実行していないのです
public class PhoneBottomDialog extends BottomSheetDialog {
public PhoneBottomDialog(Context context) {
super(context);
View view = getLayoutInflater().inflate(R.layout.phone_dialog, null);
setContentView(view);
// additional setup below this...
}
// ...
}
。ダイアログのルートレイアウトをRelativeLayout
またはLinearLayout
に変更すると、ScrollView
を追加しても何も変更されませんでした。 Android 5.0から7.1までのすべてのテストデバイスで問題が発生するため、デバイスや特定のAndroidバージョンに関連する問題でもなく、エミュレータでも発生します。
これはなぜ起こっているのでしょうか?
他のルートレイアウトを試してみてください代わりに<提案のためのandroid.support.constraint.ConstraintLayout – akhilesh0707
おかげで、ちょうど 'RelativeLayout'、残念ながら同じ問題でそれを試してみました。 –
TextInputLayout内で編集テキストを折り返してください –