2
我有一個按鈕提示的彈出對話框。我最近添加了幾個類別以顯示在屏幕上,現在對話框表現得很奇怪。點擊提示後,彈出對話框,但不會保持不變;相反,它反覆變得越來越細,然後快速地來回移動。有人遇到過這種情況麼?下面是彈出的XML代碼:Android對話框保持安靜 - 不會保持一種尺寸
<?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:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/productName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:text="TEST"
android:gravity="center"
android:textSize="25sp"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@+id/productImage" />
<TextView
android:id="@+id/category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Category"
android:textSize="20sp"
android:gravity="center"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@+id/productName" />
<TextView
android:id="@+id/size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:text="size"
app:layout_constraintRight_toLeftOf="@+id/powerType"
android:layout_marginRight="8dp"
app:layout_constraintTop_toTopOf="@+id/powerType"
android:layout_marginTop="0dp" />
<TextView
android:id="@+id/horsepower"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="horsepower"
android:gravity="left"
app:layout_constraintLeft_toRightOf="@+id/voltage"
android:layout_marginLeft="8dp"
app:layout_constraintTop_toTopOf="@+id/voltage"
android:layout_marginTop="0dp" />
<TextView
android:id="@+id/powerType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="power type"
android:gravity="left"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@+id/category"
android:layout_marginLeft="0dp"
app:layout_constraintLeft_toLeftOf="@+id/category"
android:layout_marginRight="0dp"
app:layout_constraintRight_toRightOf="@+id/category"
app:layout_constraintHorizontal_bias="0.473" />
<TextView
android:id="@+id/expProof"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="exp Proof"
android:gravity="left"
app:layout_constraintLeft_toRightOf="@+id/powerType"
android:layout_marginLeft="8dp"
app:layout_constraintTop_toTopOf="@+id/powerType"
android:layout_marginTop="0dp" />
<TextView
android:id="@+id/psi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PSI"
android:gravity="left"
app:layout_constraintRight_toLeftOf="@+id/gpm"
android:layout_marginRight="8dp"
android:layout_marginTop="0dp"
app:layout_constraintTop_toTopOf="@+id/gpm" />
<TextView
android:id="@+id/gpm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GPM"
android:gravity="left"
android:layout_marginTop="24dp"
app:layout_constraintTop_toBottomOf="@+id/voltage"
android:layout_marginLeft="0dp"
app:layout_constraintLeft_toLeftOf="@+id/voltage"
android:layout_marginRight="0dp"
app:layout_constraintRight_toRightOf="@+id/voltage"
app:layout_constraintHorizontal_bias="0.0" />
<TextView
android:id="@+id/rpm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RPM"
android:gravity="left"
app:layout_constraintLeft_toRightOf="@+id/gpm"
android:layout_marginLeft="8dp"
app:layout_constraintTop_toTopOf="@+id/gpm"
android:layout_marginTop="0dp" />
<TextView
android:id="@+id/price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Price"
android:textSize="20sp"
android:gravity="center"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="24dp"
app:layout_constraintTop_toBottomOf="@+id/gpm" />
<Button
android:id="@+id/closeDetails"
android:layout_width="@dimen/popUpDetailSections"
android:layout_height="41dp"
android:text="@string/okayButton"
android:gravity="left"
android:textSize="15sp"
android:backgroundTint="@color/colorPrimary"
android:textColor="@color/white"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="32dp"
app:layout_constraintTop_toBottomOf="@+id/price" />
<ImageView
android:id="@+id/productImage"
android:layout_width="200dp"
android:layout_height="124dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:srcCompat="@drawable/exp_proof_pump_skid"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="16dp" />
<TextView
android:id="@+id/voltage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="voltage"
android:gravity="left"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@+id/powerType"
android:layout_marginLeft="0dp"
app:layout_constraintLeft_toLeftOf="@+id/powerType"
android:layout_marginRight="0dp"
app:layout_constraintRight_toRightOf="@+id/powerType"
app:layout_constraintHorizontal_bias="0.0" />
<TextView
android:id="@+id/phase"
android:layout_width="wrap_content"
android:layout_height="16dp"
android:text="phase"
android:gravity="left"
app:layout_constraintRight_toLeftOf="@+id/voltage"
android:layout_marginRight="8dp"
app:layout_constraintTop_toTopOf="@+id/voltage"
android:layout_marginTop="0dp" />
</android.support.constraint.ConstraintLayout>
https://i.stack.imgur.com/3scVl.png < - 這是對話的截圖。所以邊界不斷擴大和壓縮,文字也不斷移動。
謝謝!!完美工作。 – llr7245