Reputation: 4431
Hello i'm implementing a custom dialog. I have a class which extends Dialog
. The problem is that i don't want to have a title, instead i want to show an image in the title bar. Can this be accomplished?
Thanks.
Upvotes: 0
Views: 2699
Reputation: 4102
Create a class that extends Dialog, then make a call to requestWindowFeature with no title.
public class CustomizeDialog extends Dialog
{
public CustomizeDialog(Context context)
{
super(context);
/** It will hide the title */
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.popup);
Then you can create your pop up xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:padding="10dip" android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageButton android:layout_width="wrap_content"
android:id="@+id/YOUR_ID"
android:layout_height="wrap_content" android:text="Close"
android:src="@drawable/YOUR_DRAWABLE"
android:background="@null" />
Then you can inflate your pop up from java
CustomizeDialog customizeDialog = new CustomizeDialog(YOUR_CONTEXT);
customizeDialog.show();
Upvotes: 1