我想問一下如果我可以在可點擊的對話框標題中製作圖標。 我使用以下幾行來設置對話框左側的標題「新建聯繫人」和右側的圖標。那麼,這個圖標(x5)可以以某種方式點擊嗎?我希望它的功能像一個關閉按鈕。對話框標題中的可點擊圖標
dialog.requestWindowFeature(Window.FEATURE_RIGHT_ICON);
dialog.setTitle("New Contact ");
dialog.setContentView(R.layout.pop_up_new_contact);//loads the layout we have already create pop_up_new_contact.xml
dialog.setFeatureDrawableResource(Window.FEATURE_RIGHT_ICON, R.drawable.x5);//adds an icon in the left of the Title.
dialog.setCancelable(true);
我使用'AlertDialog'內'DialogFragment'和編譯器把我 'android.util.AndroidRuntimeException:不能與其他標題features' – murt
結合自定義標題其實你可以使用現在 '新AlertDialog.Builder( ...)。setCustomTitle(R.layout.custom_title)' https://stackoverflow.com/a/9430855/2163045 – murt