Adjust the height of a Dialog with custom layout in Android - android

I have a dialog with custom layout, everything is working fine, except there is a big empty spaces at the top which i cannot remove.
Any suggestion how i can remove that empty space.
Here is my Code:
final Dialog dialog = new Dialog(ConferenceDetailsActivity.this);
dialog.setContentView(R.layout.l_custom_dialog_name);
final CustomEditText nameText = (CustomEditText) dialog.findViewById(R.id.confNameFld);
nameText.setText(mConferenceDetails.getConferenceName());
Button button = (Button) dialog.findViewById(R.id.dialogButtonOK);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
final CustomEditText nameText = (CustomEditText) dialog.findViewById(R.id.confNameFld);
String text = nameText.getText().toString();
dialog.dismiss();
}
});
dialog.show();
My xml Layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/nameBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/name_badge"
android:layout_alignParentTop="true" />
<com.invosys.iconference.CustomControls.CustomEditText
android:id="#+id/confNameFld"
android:layout_height="45dp"
android:layout_width="wrap_content"
android:layout_marginTop="100dp"
android:layout_marginBottom="20dp"
android:layout_alignTop="#+id/nameBackground"
android:layout_alignBottom="#+id/nameBackground"
android:layout_alignLeft="#+id/nameBackground"
android:layout_alignRight="#+id/nameBackground"
android:background="#null"
android:ems="10"
android:hint="#string/namePlaceholder"
android:gravity="center"
android:isScrollContainer="false"
android:inputType="textFilter|textNoSuggestions"
android:textColor="#color/ECharcoalColor" />
<Button
android:id="#+id/dialogButtonOK"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text=" Ok "
android:layout_below="#+id/nameBackground"
android:layout_alignLeft="#+id/nameBackground"
android:layout_alignRight="#+id/nameBackground" />
..........................
After i used this piece of code the size is reduced but it is still not unto the task;
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //before setContentView
dialog.setContentView(R.layout.logindialog);

You can try this:
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //before setContentView
dialog.setContentView(R.layout.logindialog);

Related

How to show same sized dialog in different screen sized devices

I have created a fixed size dialog in my application. While i tested with a phone of 240x320 pixel size, it shows perfect. But it shows not proper in a tablet. see the images below
image from phone
image from tab
i tried with below code
public void showDialog(){
// Create custom dialog object
final Dialog dialog = new Dialog(MainActivity.this);
// Include dialog.xml file
dialog.setContentView(R.layout.dialog);
// Set dialog title
dialog.setTitle("Custom Dialog");
// set values for custom dialog components - text, image and button
TextView text = (TextView) dialog.findViewById(R.id.textDialog);
text.setText("Custom dialog Android example.");
ImageView image = (ImageView) dialog.findViewById(R.id.imageDialog);
image.setImageResource(R.drawable.ic_launcher);
dialog.show();
dialog.getWindow().setLayout(180, 150);
Button declineButton = (Button) dialog.findViewById(R.id.declineButton);
// if decline button is clicked, close the custom dialog
declineButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// Close dialog
dialog.dismiss();
}
});
}
dialog.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="#+id/imageDialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp" />
<TextView
android:id="#+id/textDialog"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#FFF"
android:layout_toRightOf="#+id/imageDialog"/>
<Button
android:id="#+id/declineButton"
android:layout_width="100px"
android:layout_height="wrap_content"
android:text=" Submit "
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_below="#+id/textDialog"
android:layout_toRightOf="#+id/imageDialog"
/>
</RelativeLayout>
how to solve this ?
thank in advance
Finally i found the solution
I removed the lines dialog.setTitle("Custom Dialog"); and dialog.getWindow().setLayout(180, 150); lines and added dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
Corrected code as follow
public void showDialog(){
// Create custom dialog object
final Dialog dialog = new Dialog(MainActivity.this);
// Include dialog.xml file
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog);
// set values for custom dialog components - text, image and button
TextView text = (TextView) dialog.findViewById(R.id.textDialog);
text.setText("Custom dialog Android example.");
ImageView image = (ImageView) dialog.findViewById(R.id.imageDialog);
image.setImageResource(R.drawable.ic_launcher);
dialog.show();
Button declineButton = (Button) dialog.findViewById(R.id.declineButton);
// if decline button is clicked, close the custom dialog
declineButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// Close dialog
dialog.dismiss();
}
});
}
I made another change in layout file. Replaced to and lines android:layout_width="fill_parent" android:layout_height="fill_parent" to android:layout_width="180dp" android:layout_height="150dp"
Corrected layout as follows
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="180dp"
android:layout_height="150dp" >
<ImageView
android:id="#+id/imageDialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp" />
<TextView
android:id="#+id/textDialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFF" />
<Button
android:id="#+id/declineButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Submit "
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
/>
</LinearLayout>

Dialog is not displaying textview & imageview

I am new to android world and am working on dialog and in that I am trying to create a text view, button and imageview, but it is neither showing me error nor textview or imageview. It is showing a button. Here is the image:
.
But i am want to display my dialogue as follows
My xml file is as follows ....
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
tools:context=".AddFriendsCustomActivity">
<ImageView
android:id="#+id/add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/submit_dialog"
android:layout_alignParentRight="true"
android:layout_marginRight="37dp"
android:contentDescription="#string/add_Friend"
android:src="#drawable/add" />
<Button
android:id="#+id/submit_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="64dp"
android:layout_toLeftOf="#+id/add"
android:text="#string/submit" />
<EditText
android:id="#+id/writename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/add"
android:layout_marginRight="17dp"
android:layout_toLeftOf="#+id/add"
android:ems="10" />
</RelativeLayout>
I am calling it in java file as follows
dialog = new Dialog(context);
LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = li.inflate(R.layout.activity_add_friends_dialog, null, false);
dialog.setContentView(view);
dialog.setCancelable(true);
//dialog.setContentView(R.layout.activity_add_friends_dialog);
//dialog.setTitle("Add Friends");
add= (ImageView) dialog.findViewById(R.id.add);
friends1 = (TextView) dialog.findViewById(R.id.writename);
submit_dialog = (Button) dialog.findViewById(R.id.submit_dialog);
add.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
try {
friendsCount++;
Log.d("addFriendsActivity", "ashish comes here ");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
submit_dialog.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
Intent i = new Intent(AddFriendsActivity.this, DetailsFriendsActivity.class);
startActivity(i);
}
});
dialog.show();
After some google I understand that the issues might be in r.java or you have imported android .r but i have not done any thing in this ..
Thanks in advance.... :)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="horizontal" >
<EditText
android:id="#+id/writename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10" />
<ImageView
android:id="#+id/add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<Button
android:id="#+id/submit_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit" />
There is no error in your java code. Its perfect you have just change your xml. Use this.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
tools:context=".AddFriendsCustomActivity" >
<EditText
android:id="#+id/writename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="24dp"
android:ems="10" >
<requestFocus />
</EditText>
<ImageView
android:id="#+id/add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/writename"
android:layout_marginLeft="20dp"
android:layout_toRightOf="#+id/writename"
android:contentDescription="Add Friend"
android:src="#drawable/ic_launcher" />
<Button
android:id="#+id/submit_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/writename"
android:layout_below="#+id/add"
android:layout_marginRight="46dp"
android:text="Submit" />
</RelativeLayout>
For your xml I think it should look like this:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="#+id/my_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/add_btn" />
<ImageButton
android:id="#+id/add_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="#drawable/add_btn"
android:background="#null" />
<Button
android:id="#+id/submit_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#+id/my_edit_text"
android:text="Submit" />
</RelativeLayout>
Be aware that there can be some typo mistakes, because I didn't compile that code, and you should change your real variables. And create your AlertDialog like this:
AlertDialog.Builder mBuilder = new AlertDialog.Builder(MyActivity.this);
View mView = mInflater.inflater(R.layout.my_layout, null, false);
EditText mEdit = (EditText) mView.findViewById(R.id.my_edit_text);
ImageButton mImageBtn = (ImageButton) mView.findViewById(R.id.add_btn);
Button mSubmit = (Button) mView.findViewById(R.id.submit_btn);
mBuilder.setView(mView);
AlertDialog mAlert = mBuilder.create();
mAlert.show();
Using AlertDialog.Builder instead of Dialog is lot more easier for your situation (at least in my opinion). And you can add your Submit Button to your AlertDialog as default positive button.
Hope this helps you.
Look at your code i think
add= (ImageView) dialog.findViewById(R.id.add);
friends1 = (TextView) dialog.findViewById(R.id.writename);
as
add= (ImageView) view.findViewById(R.id.add);
friends1 = (EditText) view.findViewById(R.id.writename);
That should work.
Try this..
final Dialog dialog = new Dialog(AddFriendsActivity.this);
dialog.setContentView(R.layout.activity_add_friends_dialog);
dialog.setCanceledOnTouchOutside(true);
add= (ImageView) dialog.findViewById(R.id.add);
EditText friends1 = (EditText) dialog.findViewById(R.id.writename);
submit_dialog = (Button) dialog.findViewById(R.id.submit_dialog);
add.setOnClickListener(new OnClickListener() {
//#Override
#SuppressWarnings({ "unchecked", "rawtypes" })
#SuppressLint("NewApi")
public void onClick(View v) {
friendsCount++;
//TextView textview = new TextView(context);
//textview.setId(friendsCount);
//final RelativeLayout.LayoutParams params= new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
//params.addRule(RelativeLayout.BELOW, friendsCount--);
//textview.setLayoutParams(params);
//textview.setVisibility(View.VISIBLE);
//relativelayout.addView(textview ,params);
Log.d("addFriendsActivity", "ashish comes here ");
}
});
submit_dialog.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
Intent i = new Intent(AddFriendsActivity.this, DetailsFriendsActivity.class);
startActivity(i);
}
});
dialog.show();
Your view is covered.
May be you can try to set your parent layout to Linearlayout, not RelativeLayout.

How to put close button at top corner in alert dialog box for android?

How to put close button at top corner in alert dialog box for android?
put close button at right side top corner in alert dialog.
i have used below code for scroll and dialog box
<ScrollView
android:id="#+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true" >
<ImageVieandroid:id="#+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="200dp"
android:src="#drawable/ic_launcher" />
</RelativeLayout>
</ScrollView>
in java coding i have used below coding
i want to put a image to close the dialog box
please help
public void onClick(View v)
{
// TODO Auto-generated method stub
switch (v.getId())
{
case R.id.How_to_use:
final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.description);
dialog.setTitle("How to use");
TextView text = (TextView) dialog.findViewById(R.id.description);
text.setText(R.string.Descr_How_to_use);
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.ic_launcher);
image.setOnClickListener(new OnClickListener()
{
// #Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
break;
default:
break;
}
I know, I am late to answer this 2 yrs old question, but this one is for those who don't know a correct approach yet....
Use a Custom Dialog as (everyone has suggested).
Use a RelativeLayout as the main layout of custom_dialog.xml as you will have to float that cancel button on top corner (right/left) of the main window.
custom_dialog.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:background="#F4F4F4">
<!--Main Body of your custom dialog-->
</RelativeLayout>
<LinearLayout
android:id="#+id/llTop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:orientation="vertical">
<ImageButton
android:id="#+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btnBookK"
android:background="#null"
android:src="#drawable/ic_close" />
</LinearLayout>
</RelativeLayout>
In your custom dialog code use following line to make it transparent:
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
customDialog.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:id="#+id/llTop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:paddingBottom="10dp"
>
<Button
android:id="#+id/btnClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="Close"
/>
</LinearLayout>
<ImageView
android:src="#drawable/ic_launcher"
android:layout_width="130dp"
android:layout_height="130dp"
android:text="Close"
android:layout_centerInParent="true"
android:layout_below="#+id/llTop"
/>
</RelativeLayout>
I have created 1 method whenever you want to display dialog just call this method.
private Dialog dialog; // class variable
private void showDialog
{
dialog = new Dialog(Activity.this); // always give context of activity.
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.customDialog);
Button dialogButton = (Button) dialog.findViewById(R.id.btnClose);
dialogButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v)
{
dialog.dismiss();
}
});
dialog.show();
}
Yo have to create custom dialog
import android.app.Dialog;
import android.content.Context;
public class CustomDialog extends Dialog
{
public CustomDialog(Context context)
{
super(context);
setContentView(R.layout.dialog);
}
}
create dialog.xml file. design according to your requirment.

EditText Field Is Crashing My Android App

Hi all i have updated my post to show the full xml file, which will show if i am doing something wrong.
i implemented a custom dialog with an edit text field and it keeps crashing. I will
also like to access the values filled in the text field. Any idea where i am going wrong? Thanks.
Below is the offending/troublesome??? code
First i show the xml file which contains my layout for the alert dialog.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<ImageView android:id="#+id/ImageView01"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />
<ScrollView android:id="#+id/ScrollView01"
android:layout_width="wrap_content" android:layout_below="#+id/ImageView01"
android:layout_height="200px">
<TextView android:text="#+id/TextView01" android:id="#+id/TextView01"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<EditText
android:id="#+id/lastname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="blah"
/>
</ScrollView>
<Button android:id="#+id/Button01"
android:layout_below="#id/ScrollView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Cancel" />
</RelativeLayout>
Then main activity file which implements
my button click events...etc.
.......
setContentView(R.layout.main);
//this button will show the dialog
Button button1main = (Button) findViewById(R.id.Button01main);
button1main.setOnClickListener(new View.OnClickListener() {
public void onClick(View OnClickListener) {
//set up dialog
final Dialog dialog = new Dialog(MoredialogActivity.this);
dialog.setContentView(R.layout.maindialog);
dialog.setTitle("This is my custom dialog box");
dialog.setCancelable(true);
TextView text = (TextView) dialog.findViewById(R.id.TextView01);
text.setText(R.string.lots_of_text);
//set up image view
ImageView img = (ImageView) dialog.findViewById(R.id.ImageView01);
img.setImageResource(R.drawable.icon);
//set up button
Button button = (Button) dialog.findViewById(R.id.Button01);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
dialog.dismiss();
//finish();
}
});
dialog.show();
}
});
}
}
You have two items in your ScrollView. According to the doc :
A ScrollView is a FrameLayout, meaning you should place one child in
it containing the entire contents to scroll; this child may itself be
a layout manager with a complex hierarchy of objects.
So you should had another layout, like a linear layout :
<ScrollView
android:id="#+id/ScrollView01"
android:layout_width="wrap_content"
android:layout_below="#+id/ImageView01"
android:layout_height="200px">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center">
<TextView
android:text="#+id/TextView01"
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/lastname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="blah" />
</LinearLayout>
</ScrollView>

Issue with custom alert dialog

I'm using a custom layout for an alert dialog, in which I set a custom background image.
When displayed, it seems that the dialog box is higher than my image background, while I set the layout dimensions to the image dimensions.
How can I set the dialog box dimensions to the dimensions of my background image? How can I remove this white border?
Thanks
dialog layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/layout_root"
android:orientation="vertical"
android:background="#drawable/whip_sel_dialog_bg"
android:layout_width="279dp"
android:layout_height="130dp" >
<TextView android:id="#+id/dialog_title"
android:textColor="#FFF"
android:textSize="16sp"
android:textStyle="bold"
android:text="#string/dialog_title"
android:layout_width="fill_parent" android:gravity="center" android:layout_height="30dp" android:layout_marginTop="5dp"/>
<TextView android:id="#+id/dialog_text"
android:textColor="#FFF"
android:layout_height="35dp" android:layout_width="fill_parent" android:gravity="center"/>
<LinearLayout android:id="#+id/confirmation"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:gravity="center">
<Button android:id="#+id/button_cancel"
android:layout_width="128dp"
android:layout_height="43dp"
android:background="#drawable/btn_ok"
android:textColor="#FFF"
android:text="#string/cancel"
android:layout_marginRight="10dp"/>
<Button android:id="#+id/button_ok"
android:layout_width="128dp"
android:layout_height="43dp"
android:background="#drawable/btn_ok"
android:textColor="#FFF"
android:text="#string/ok" />
</LinearLayout>
</LinearLayout>
dialog class
public class WSelDialog extends Dialog implements OnClickListener {
private Button okButton, cancelButton;
public WSelDialog() {
super(MainActivity.this);
setContentView(R.layout.whipem_dialog);
okButton = (Button) findViewById(R.id.button_ok);
okButton.setText(getString(R.string.whip_sel_ok));
okButton.setOnClickListener(this);
cancelButton = (Button) findViewById(R.id.button_cancel);
cancelButton.setText(getString(R.string.whip_sel_cancel));
cancelButton.setOnClickListener(this);
TextView text = (TextView) findViewById(R.id.dialog_text);
text.setText(getString(R.string.whip_sel));
text.setOnClickListener(this);
}
#Override
public void onClick(View v) {
((GlobalVars)getApplicationContext()).playSound(100);
if (v == cancelButton)
dismiss();
else {
Intent i = new Intent(MainActivity.this, WhipSelection.class);
startActivity(i);
}
}
};
It looks like the dialog reserves this space for its title. See Android: How to create a Dialog without a title.

Categories

Resources