Yup dies wird mehrere Möglichkeit gefragt, aber keiner der Methode funktioniert.Machen Sie Dialog-Breite auf den Vollbildmodus
Ich versuche, die Dialogbreite auf Vollbild auszugeben.
Dialog Layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/constraint_layout"
android:layout_width="match_parent"
android:layout_height="300dp">
<android.support.constraint.Guideline
android:id="@+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.08" />
<TextView
android:fontFamily="@font/gotham_medium_regular"
android:textAllCaps="true"
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Login"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:fontFamily="@font/gotham_light"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/textView6"
android:id="@+id/textView7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Enter your phone number to proceed" />
<android.support.design.widget.TextInputLayout
android:id="@+id/text_input"
android:layout_marginTop="24dp"
android:layout_width="0dp"
app:layout_constraintTop_toBottomOf="@+id/textView7"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="@+id/guideline4"
app:layout_constraintStart_toStartOf="@+id/guideline3">
<android.support.design.widget.TextInputEditText
android:id="@+id/userPhone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/gotham_light"
android:hint="PHONE NUMBER"
android:inputType="phone"
android:text="+91" />
</android.support.design.widget.TextInputLayout>
<android.support.constraint.Guideline
android:id="@+id/guideline4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.92" />
<Button
android:layout_marginBottom="@dimen/activity_horizontal_margin"
android:id="@+id/continueButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@drawable/button_background"
android:fontFamily="@font/gotham_light"
android:text="Continue"
android:textColor="@android:color/white"
app:layout_constraintEnd_toEndOf="@+id/guideline4"
app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/text_input" />
</android.support.constraint.ConstraintLayout>
Dialog Code:
val dialogBuilder = AlertDialog.Builder(ContextThemeWrapper(context,R.style.ThemeDialog))
val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
val dialogView = inflater.inflate(R.layout.mobile_bottom_sheet_layout, null)
val phone = dialogView.findViewById<EditText>(R.id.userPhone)
dialogBuilder.setView(dialogView)
val alertDialog = dialogBuilder.create()
val countinueButton = dialogView.findViewById<Button>(R.id.continueButton) as Button
countinueButton.setOnClickListener {
if(phone.text.toString().isEmpty()){
phone.error=getString(R.string.empty)
phone.requestFocus()
}else if(phone.text.toString().length!=13){
phone.error=getString(R.string.phone_length_error)
phone.requestFocus()
}else{
checkIfTrainerExists(phone.text.toString(),[email protected]);
}
}
alertDialog.show()
Dinge, die ich versucht habe:
- https://stackoverflow.com/a/28519059/1640009
- https://stackoverflow.com/a/2680670/1640009
- https://stackoverflow.com/a/6631310/1640009
Ich habe die anderen Lösungen auch ausprobiert. Aber keiner funktioniert.
haben Sie versucht, diese https://stackoverflow.com/a/40718796/8112541 – Prem
ja @ Prem. Aber es hat auch nicht funktioniert –
machen Sie Ihre ** 'ConstraintLayout' ** Höhe zu **' Android: layout_width = "match_parent" android: layout_height = "match_parent" '** – Prem