2012-05-08 25 views
0

私はダイアログボックスを持っていますが、未知の背景イメージがどのようにあるかを示しています。どうすればその画像を削除できますか?私を案内してください。あなたが標準AlertDialogを使用してコンテンツビュー+タイトルなしを(それがダイアログに残るためにあなたがタイトルにスペースを設定していないが)を設定するので、おそらく何が起こっているダイアログボックスがアンドロイドで適切にレンダリングされない

enter image description here

答えて

2

あなたは、あなたがこの

のように行うことができますカスタムダイアログクラスのためにいくつかのカスタマイズ

を作ることができる

もちろんの
<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Do you Want to bookmark?" 
     android:gravity="center"/> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 

     <Button 
      android:id="@+id/button_no" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="No" /> 

     <Button 
      android:id="@+id/button_yes" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Yes" /> 

    </LinearLayout> 

</LinearLayout> 

のようなあなたのダイアログ何かのためのあなたのXMLファイルを構築し、ダイアログクラスを拡張する必要があります

public class CustomizeDialog extends Dialog implements OnClickListener { 
Button okButton; 

public CustomizeDialog(Context context) { 
    super(context); 

    /** 'Window.FEATURE_NO_TITLE' - Used to hide the title */ 
    requestWindowFeature(Window.FEATURE_NO_TITLE); 


    setContentView(R.layout.main); 
    yesButton = (Button) findViewById(R.id.button_yes); 
    yesButton.setOnClickListener(this); 

    noButton = (Button) findViewById(R.id.button_no); 
    noButton.setOnClickListener(this); 

} 

@Override 
public void onClick(View v) { 
     switch(v.getId()){ 

     case R.id.button_yes: 
      dismiss(); 
      //doSomething 
      break; 
      case R.id.button_no: 
      dismiss(); 
      //doSomethingElse 
      break; 

} 

} 

希望すると、 あなたのコードを投稿して、これらの背景ボックスがあなたのために表示される理由を理解してくださいあなたの問題を解決する必要があります

1

Dialogクラスを拡張し、必要に応じてダイアログを構築します。また、あなたがTheme.Dialogを拡張するテーマを実装し、オーバーライドし、その後Dialogのために独自の背景を使用する場合:

<item name="android:windowBackground">@android:drawable/panel_background</item> 

独自の描画可能に。

+0

それは素晴らしいです...しかし、私は例を提供することができます...... – Programmer

関連する問題