2012-01-17 12 views
2

OSテーマに関係なく、異なるデバイス間で正確に同じように見えるダイアログを構築する必要があります。現時点ではAlertDialogを作成しましたが、alertDialog.setView(myLayout)に電話します。これは、私のビューとのダイアログを作成します。しかし、ダイアログボックスの一部(外側の部分と境界線)はまだOSに基づいており、SamsungやHTCの外観が異なっています。デバイスに関係なく同じ外観のAndroidでの完全なカスタムダイアログ

実際のボックスを作成するにはどうしますか?

+0

おそらくhttp://stackoverflow.com/questions/8888075/alert-dialog-customizationが役立ちます。 – Ghost

答えて

3

ゴーを見てください、その後透明なダイアログ

のために編集

  FullyscutomDialo hh=new FullyscutomDialo (this); 
     hh.show() 

(onclickeventなどでもよい)の活動から、それを表示するために2本のラインを使用

ダイアログボックスクラスのonCreateで使用

this.getWindow().setBackgroundDrawable(new ColorDrawable(0)); 

乾杯:) :)

3

ビューまたはアクティビティにテーマを指定できます。 この

import android.app.Dialog; 
import android.content.Context; 
import android.os.Bundle; 

public class FullyscutomDialo extends Dialog{ 

public FullyscutomDialo(Context context) { 
    super(context); 
    // TODO Auto-generated constructor stub 
} 

@Override 
public void dismiss() { 
    //do what you need before closing here 
    super.dismiss(); 
} 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    //set your custom layout here 
    //use layout attribut just like activity 
} 

} 

ためthis link

1

xmlファイルを作成します。 このJavaコードを使用してください。

     info_dialog = new Dialog(ActivityName.this); 
         info_dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
         info_dialog.setContentView(R.layout.info);       
         info_dialog.show(); 
関連する問題