2017-06-14 7 views
2

ボタンでプロンプトが表示されるポップアップダイアログがあります。私は最近、画面に表示されるカテゴリをいくつか追加しました。そして今、ダイアログは奇妙な動作をしています。プロンプトをクリックすると、ダイアログが表示されますが、それでも表示されません。代わりに、それは繰り返してより細くなり、より早く前後に動きます。他に誰かがこれに遭遇しましたか?ここでは、ポップアップのためのXMLコードは次のとおりです。Androidのダイアログがぼんやりしている - 1つのサイズのままではありません

<?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 < - これは、ダイアログのスクリーンショットです。境界が拡大して圧縮し続けるので、テキストも動き続けます。

答えて

1

この

Window window = customDialog.getWindow(); 
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.WRAP_CONTENT); 
+0

はありがとうてみてください!!完璧に働いた。 – llr7245

関連する問題