put EditText into a layout so can have some margins.

This commit is contained in:
Andy2 2011-06-10 20:55:18 -07:00
parent 1a89ed1f14
commit bb82831fb4
2 changed files with 22 additions and 9 deletions

View file

@ -1,9 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:autoText="false"
android:capitalize="words"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText android:id="@+id/name_edit"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginLeft="30dip"
android:layout_marginRight="30dip"
android:autoText="false"
android:capitalize="words"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
</LinearLayout>

View file

@ -38,6 +38,7 @@ import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Button;
import android.view.MenuInflater;
@ -161,15 +162,17 @@ public class GamesList extends XWListActivity
});
break;
case GET_NAME:
LinearLayout layout =
(LinearLayout)Utils.inflate( this, R.layout.dflt_name );
final EditText etext =
(EditText)Utils.inflate( this, R.layout.dflt_name );
(EditText)layout.findViewById( R.id.name_edit );
etext.setText( CommonPrefs.getDefaultPlayerName( this, 0,
true ) );
dialog = new AlertDialog.Builder( this )
.setTitle( R.string.default_name_title )
.setMessage( R.string.default_name_message )
.setPositiveButton( R.string.button_ok, null )
.setView( etext )
.setView( layout )
.create();
dialog.setOnDismissListener(new DialogInterface.
OnDismissListener() {