I'm trying to customise the appearance of an AlertDialog. The problem is that I don't know how to get rid of the black lines that appear above my first TextView and EditText at the bottom (above the grey button regions).
Here is is my XML. What am I missing?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#color/butGreyBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="30"
android:text=""
android:background="#00000000"
android:textColor="#android:color/white"
android:textSize="22sp"
android:layout_margin="0dp"
android:gravity="center" />
<TextView
android:id="#+id/tv_prompt"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="30"
android:text=""
android:background="#00000000"
android:textColor="#android:color/white"
android:textSize="18sp"
android:layout_margin="0dp"
android:gravity="center" />
<EditText
android:id="#+id/edit_text"
android:inputType="textCapSentences|textAutoCorrect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"/>
</LinearLayout>
Here's the code too - which is probably where the problem lies:
View alertView;
AlertDialog.Builder builder = new AlertDialog.Builder( mContext );
LayoutInflater inflater = LayoutInflater.from(getApplicationContext());
alertView = inflater.inflate(R.layout.alert_dialog_text, null);
builder.setView( alertView );
AlertDialog alertDialog = builder.create();
alertDialog.setView( alertView, 0,0,0,0 );
final EditText input = (EditText) alertView.findViewById( R.id.edit_text );
TextView tvTitle = (TextView) alertView.findViewById( R.id.tv_title );
TextView tvPrompt = (TextView) alertView.findViewById( R.id.tv_prompt );
tvTitle.setText( "Rename Playlist" );
tvPrompt.setText( "Enter new Playlist name." );
// Set up the buttons
builder.setPositiveButton( "OK", new DialogInterface.OnClickListener()
{
#Override
public void onClick( DialogInterface dialog, int which )
{
mNewName = input.getText().toString();
}
} );
builder.setNegativeButton( "Cancel", new DialogInterface.OnClickListener()
{
#Override
public void onClick( DialogInterface dialog, int which )
{
mNewName = "";
dialog.cancel();
}
} );
builder.show();
#sparky...
1) xml in Values Folder and add this code
wrap_content
wrap_content
#color/transparent1
false
true
and make a reference this Theme to Your Dialog Like this
Dialog dialog = new Dialog(activity, R.style.CustomDialogTheme);
then set Your custom Dialog Layout Xml file as setContentView.
dialog.setContentView(R.layout.customdialog);
2)you are not closing the parent LinearLayout at the end
and you are using #000000 color code for parent layout this will display black color at background
try to change the color code you bottom color will chance. and use
requestWindowFeature(Window.FEATURE_NO_TITLE);
in you dialog class this will remove the dialog title so your top color also will remove..
Let me know if you need any help
Thanks
I fixed this in the end by implementing my own custom dialog instead of using the AlertDialog.
Related
I am stuck with a margin and padding issue of a title of AlertDialog.Builder, what i am doing is i want the title in center so i am using setCustomTitle i am able to do so but stuck with margin and padding of it. I don't want unwanted padding which is showing and also i want to set some top margin to title, i am using LinearLayout.LayoutParams but it has no effect. please suggest what to do to handle it.thanks
Code :
dialog = new AlertDialog.Builder(context, R.style.DialogTheme);
TextView title = new TextView(context);
title.setTextColor(ContextCompat.getColor(context, R.color.black));
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
title.setTypeface(Typeface.DEFAULT_BOLD);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
lp.setMargins(0, 20, 0, 0);
title.setLayoutParams(lp);
title.setText("Dialog");
title.setGravity(Gravity.CENTER);
dialog.setCustomTitle(title);
dialog.setMessage("Dialog box with custom title view ");
dialog.setCancelable(false);
dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
}
});
dialog.show();
Result :
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
TextView title = new TextView(this);
title.setTextColor(ContextCompat.getColor(this, android.R.color.black));
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
title.setTypeface(Typeface.DEFAULT_BOLD);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
lp.setMargins(0, 20, 0, 0);
title.setPadding(0,30,0,0);
title.setLayoutParams(lp);
title.setText("Dialog");
title.setGravity(Gravity.CENTER);
dialog.setCustomTitle(title);
dialog.setMessage("Dialog box with custom title view ");
dialog.setCancelable(false);
dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
}
});
dialog.show();
Replace this code it will work
You can avoid setting up all this methods to your AlertDialog by using DialogFragment. Just use getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); in onCreateView method and make your own custom view for the dialog in the way you create a common fragment. It's a better way to make proper dialogs.
I suggest you to use DialogFragment to show custom layout as alert Dialog its very easy and we can customize our dialog as per requirement..for more detail about it : https://developer.android.com/reference/android/app/DialogFragment.html
Below is the layout as per your requirement, You can use the below xml layout to show your custom layout.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<LinearLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="#dimen/margin10dp"
android:layout_weight="1"
android:gravity="center"
android:text="My Dialog"
android:textColor="#color/white"
android:textSize="22dp"
android:textStyle="bold" />
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header"
android:padding="10dp">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="My Dialog Box Description !"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20dp" />
<Button
android:id="#+id/btnSubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView2"
android:background="#android:color/transparent"
android:text="OK"
android:textSize="22dp" />
</RelativeLayout>
</RelativeLayout>
I am just trying to build a alertdialog for my android application.
what I actually want is a dialog box like this:
whose positive and negative button are filled across dialog box
but I always get something like this:
and these two buttons stick together at the right corner of dialog box
can anybody tell me what to do to change the alertdialog from the second one to first one?
many thanks
For that You need to create custom dilogbox Like this
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/image"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="#drawable/ic_launcher"
android:src="#drawable/ic_launcher" />
<Button
android:id="#+id/button"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_below="#+id/image"
android:layout_centerHorizontal="true"
android:text="Dismiss" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_above="#+id/button"
android:layout_toRightOf="#+id/image"
android:gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
And In your Activity :
final Dialog dialog = new Dialog(MainActivity.this);
//setting custom layout to dialog
dialog.setContentView(R.layout.cusotm_dialog_layout);
dialog.setTitle("Custom Dialog");
//adding text dynamically
TextView txt = (TextView) dialog.findViewById(R.id.textView);
txt.setText("Put your dialog text here.");
ImageView image = (ImageView)dialog.findViewById(R.id.image);
image.setImageDrawable(getResources().getDrawable(android.R.drawable.ic_dialog_info));
//adding button click event
Button dismissButton = (Button) dialog.findViewById(R.id.button);
dismissButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
You can set customized layout to alert dialog by using setView(view) method like this:
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
LayoutInflater inflater = this.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.alert_layout, null);
dialogBuilder.setView(dialogView);
AlertDialog alertDialog = dialogBuilder.create();
alertDialog.show();
I am trying to design AlertDialog, but I can't get rid of the black surrounding (As indicated by the red line), and the orange surrounding (As indicated by the blue line).
This is my xml code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#android:color/darker_gray" >
<TextView
android:src="#drawable/save_as"
android:id="#+id/label_save_as"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/black"
android:text="#string/save_as" />
<EditText
android:id="#+id/filename"
android:inputType="textEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:hint="#string/filename" />
</LinearLayout>
This is the code:
AlertDialog.Builder saveAsBuilder = new AlertDialog.Builder(this);
LayoutInflater saveAsInflater = this.getLayoutInflater();
saveAsBuilder.setView(saveAsInflater.inflate(R.layout.saveas, null))
.setNeutralButton(R.string.saveAsImg, new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int id) {
// do something
}
})
.setPositiveButton(R.string.saveAsSkt, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// do something
}
});
d = saveAsBuilder.create();
d.setCanceledOnTouchOutside(true);
d.show();
How can I get rid of those?
BTW , I am using API 10.
Once try to change like this and try..
AlertDialog.Builder saveAsBuilder = new AlertDialog.Builder(this,android.R.style.Theme_Translucent);
setting the theme for the dialog to remove the black spaces
with using dialog..
Dialog dialog=new Dialog(getApplicationContext());
dialog.setContentView(R.layout.yourlayout);
for this you have to create two buttons in layout and implement listeners for that..
I want to create a different theme for all of alertDialog instances. I need my own title view instead of the usual black title background. All text should have a blue color, and set the edge of the alertDialog to a round shape.
Is it possible to create our own theme for alert dialogs, using any style or creating a class which extends AlertDialog.Builder? I need a common theme or style for my all instances of alertDialog. I am using alertDialog in many places - one for singleChoice items, one with ArrayAdapter.
My alertDialog with array adapter:
String[] items = {"Edit profile","Change user","Change password","Logout"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(Loged.this,
R.layout.my_spinner_layout, items);
settingMenu.setAdapter(adapter, listener);
My alertDialog with single choice items:
alertDelete = new AlertDialog.Builder(getParent());
alertDelete.setTitle("Delete");
alertDelete.setCancelable(true);
CharSequence[] choice = {"this user","All user"};
alertDelete.setSingleChoiceItems(choice, 0,
For my all alertDialog, I need a common theme, like:
please check this link. here am creating my own alertDialog class
and its a simple method if you reuse the alertDialog in many situation in your application
how Create setAdapter() for a AlertDialog
I solved my problem by creating a class which extends Dialog, and I created my own functions. for example setMessage,setTitle,setPositiveButton,setNegativeButton etc.
But am confusing on how we can replace the setAdapter() and setSingleChoice().
Here one example For Dialog:
button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
// custom dialog
final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.custom);
dialog.setTitle("Give a Title...");
// set the custom dialog components - text, image and button
TextView text = (TextView) dialog.findViewById(R.id.text);
text.setText("Put here any custom text!");
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.ic_launcher);
Button dialogButton = (Button) dialog.findViewById(R.id.ButtonOK);
// if button is clickedthen dialog will closed
dialogButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
}
});
Custom AlertDialog
AlertDialog.Builder builder;
AlertDialog alertDialog;
Context mContext;
LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View urlayoutfile = inflater.inflate(R.layout.custom_dialog_xmlfile,(ViewGroup)findViewById(R.id.Yourlayout_id));
builder = new AlertDialog.Builder(this);
builder.setView(urlayoutfile);
alertDialog = builder.create();
alertDialog.show();
To use a specific style, use
ctw = new ContextThemeWrapper(this, R.style.MyStyle);
new AlertDialog.Builder(ctw)
.setTitle(...)
You can use layout as Different themes, styles, Backgrounds
customdialog.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativeLayout1"
style="#android:style/Theme.Black.NoTitleBar.Fullscreen"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="#+id/layoutsample"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/dialoghdrbg"
android:orientation="horizontal" >
<ImageView
android:id="#+id/dialogheaderimage1"
android:layout_width="50dp"
android:layout_height="48dp"
android:scaleType="fitXY"
/>
<TextView
android:id="#+id/dialogheadertext1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginLeft="1dp"
android:gravity="center_vertical|right"
android:textColor="#000000"
android:textSize="25dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/dialogcontentbg"
android:orientation="vertical" android:gravity="center">
<TextView
android:id="#+id/dialogmessgetext1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#ffffff"
android:textSize="23dp"
android:text=""
android:gravity="center"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|center_horizontal"
android:gravity="center|center_horizontal"
android:layout_marginTop="20dip"
android:orientation="horizontal">
<Button
android:id="#+id/dialogokbutton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:background="#drawable/buttonanimation"
android:text="Retry"
android:textSize="20dp"
android:textStyle="bold" />
<Button
android:id="#+id/dialogcancelbutton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:background="#drawable/buttonanimation"
android:text="Report"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
customDialog.java
final Dialog favDialog = new Dialog(Myclass.this,
android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
favDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
favDialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
favDialog.setContentView(R.layout.reloadurlpopuplayout);
favDialog.setCancelable(false);
ImageView dialogImage = (ImageView) favDialog
.findViewById(R.id.dialogheaderimage1);
dialogImage.setBackgroundResource(R.drawable.questionmark);
TextView dialogMesage = (TextView ) favDialog
.findViewById(R.id.dialogmessgetext1);
TextView dialogHeader = (TextView) favDialog
.findViewById(R.id.dialogheadertext1);
String descText = getString(R.string.RetryReportMessage);
dialogMesage.setBackgroundColor(0x00000000);
dialogMesage.setText(descText);
dialogHeader.setText(R.string.BrockenLinkHeader);
try {
favDialog.show();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I'm trying to set the Positive, Negative and Neutral buttons of an AlertDialog to drawables rather than text.
I've been successful thus far using this:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to exit?")
.setPositiveButton("Save", new DialogInterface.OnClickListener() {...})
.setNeutralButton("Trash", new DialogInterface.OnClickListener() {...})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {...});
AlertDialog alert = builder.create();
alert.show();
Button button0 = alert.getButton(AlertDialog.BUTTON_POSITIVE);
button0.setCompoundDrawablesWithIntrinsicBounds(this.getResources().getDrawable(R.drawable.ic_menu_save), null, null, null);
button0.setText("");
Button button1 = alert.getButton(AlertDialog.BUTTON_NEUTRAL);
button1.setCompoundDrawablesWithIntrinsicBounds(this.getResources().getDrawable(R.drawable.ic_menu_delete), null, null, null);
button1.setText("");
Button button2 = alert.getButton(AlertDialog.BUTTON_NEGATIVE);
button2.setCompoundDrawablesWithIntrinsicBounds(this.getResources().getDrawable(R.drawable.ic_menu_close_clear_cancel), null, null, null);
button2.setText("");
This is a workaround though, because I'm really just erasing the text after the fact. My problem is that you can't seem to instantiate a button without setting some kind of text.
Setting "[blank_space]" from the beginning yields the same result with the image being pushed to the left. Setting null or "" in the same place draws the AlertDialog without the button at all. You can see how it pushes to the left in the picture here:
Is there anyway to use pictures only? It would be much nicer than trying to handle translations for my simple situation.
AlertDialog is deprecated. Consider using DialogFragments instead. You'll have much more control and reuse ability. Here is a good google blog that demonstrated how to use it and customize it.
From android document,
setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top, Drawable right, Drawable bottom)
Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text.
Since you put your image on the left, therefore the image will display on the left of the button. You may try to place it at top/bottom.
The other way is to create your custom layout with 3 ImageButtons, and set it to the alert by
builder.setView(customLayout);
You have just to create your own custom dialog!! You can specify your ImageButton in a layout, then create a dialog with that layout, you don't need to go near the positive, negative and neutral buttons. You can find here a good tutorial just use ImageButton instead of Buttons in your custom layout.
Try this code:
LayoutInflater inflater=LayoutInflater.from(YourActivityName.this);
View view=inflater.inflate(R.layout.buttton, null);
AlertDialog.Builder builder=new AlertDialog.Builder(YourActivityName.this);
builder.setView(view);
builder.setTitle("Are you sure you want to exit?");
Button posButton=(Button) view.findViewById(R.id.pos);
Button neuButton=(Button) view.findViewById(R.id.neu);
Button negButton=(Button) view.findViewById(R.id.neg);
builder.create();
builder.show();
inflate buttton xml file as below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<Button
android:id="#+id/pos"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#drawable/ic_launcher"/>
<Button
android:id="#+id/neu"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#drawable/ic_launcher"/>
<Button
android:id="#+id/neg"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#drawable/ic_launcher"/>
</LinearLayout>
And at the end you can give click events to the individuals.Hope this will help you.
CustomDialog dialog = new Dialog(MyActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.login);
final EditText editTextEmailAddress = (EditText) dialog
.findViewById(R.id.editTextEmailAddress);
final EditText editTextPassword = (EditText) dialog
.findViewById(R.id.editTextPassword);
TextView txtViewForgetPswd = (TextView) dialog
.findViewById(R.id.txtViewForgetPswd);
txtViewForgetPswd.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
// RETRIVE PASSWORD
dialog.dismiss();
}
});
ImageButton imgBtnSubmit = (ImageButton) dialog
.findViewById(R.id.imgBtnSubmit);
imgBtnSubmit.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
// CALL WEBSERVICE OR ASYNTASK TO LOG IN USER
String userName = editTextEmailAddress.getText()
.toString();
String password = editTextPassword.getText().toString();
if (userName.equals("") && password.equals("")) {
Toast.makeText(BibleActivity.this,
"Username or password cannot be empty.",
Toast.LENGTH_SHORT).show();
} else {
}
}
});
ImageButton imgBtnCancel = (ImageButton) dialog
.findViewById(R.id.imgBtnCancel);
imgBtnCancel.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
// CLOSE DIALOG HERE FROM CROSS BUTTON
dialog.dismiss();
}
});
ImageButton btnCancelCross = (ImageButton) dialog
.findViewById(R.id.btnCancelCross);
btnCancelCross.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
// CLOSE DIALOG HERE FROM CROSS BUTTON
dialog.dismiss();
}
});
dialog.show();
////XML LAYOUT "login"///
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="480dp"
android:background="#drawable/mbc_login" >
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="45dp"
android:layout_alignParentTop="true" >
<ImageButton
android:id="#+id/btnCancelCross"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_marginRight="20dp"
android:background="#drawable/cross" >
</ImageButton>
</FrameLayout>
<TextView
android:id="#+id/txtViewEmailLbl"
android:layout_width="200dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
android:text="Email address"
android:textColor="#000000" >
</TextView>
<EditText
android:id="#+id/editTextEmailAddress"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_below="#+id/txtViewEmailLbl"
android:layout_centerHorizontal="true"
android:hint="example#eg.com"
android:imeOptions="actionNext" >
</EditText>
<TextView
android:id="#+id/txtViewPswdLbl"
android:layout_width="200dp"
android:layout_height="20dp"
android:layout_below="#+id/editTextEmailAddress"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Password"
android:textColor="#000000" >
</TextView>
<EditText
android:id="#+id/editTextPassword"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_below="#+id/txtViewPswdLbl"
android:layout_centerHorizontal="true"
android:hint="password123"
android:imeOptions="actionNext"
android:inputType="textPassword" >
</EditText>
<TableRow
android:id="#+id/tblRowSubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editTextPassword"
android:layout_centerHorizontal="true"
android:layout_margin="10dp" >
<ImageButton
android:id="#+id/imgBtnSubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:background="#drawable/btn_submit" >
</ImageButton>
<ImageButton
android:id="#+id/imgBtnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_cancel" >
</ImageButton>
</TableRow>
<TextView
android:id="#+id/txtViewForgetPswd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tblRowSubmit"
android:layout_centerHorizontal="true"
android:layout_margin="5dp"
android:text=" Forget Password ? "
android:textColor="#306EFF"
android:textStyle="italic" >
</TextView>
</RelativeLayout>