use a layout instead of a raw text widgit.

This commit is contained in:
Andy2 2011-06-10 20:02:14 -07:00
parent 1cc2717d50
commit d058e3fd4b
3 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,9 @@
<?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"
/>

View file

@ -161,7 +161,8 @@ public class GamesList extends XWListActivity
});
break;
case GET_NAME:
final EditText etext = new EditText( this );
final EditText etext =
(EditText)Utils.inflate( this, R.layout.dflt_name );
etext.setText( CommonPrefs.getDefaultPlayerName( this, 0,
true ) );
dialog = new AlertDialog.Builder( this )

View file

@ -32,6 +32,7 @@ import android.app.Activity;
import android.app.Dialog;
import android.widget.EditText;
import android.widget.TextView;
import android.view.LayoutInflater;
import android.view.View;
import android.text.format.Time;
import java.util.Formatter;
@ -104,6 +105,12 @@ public class Utils {
Toast.makeText( context, text, Toast.LENGTH_SHORT).show();
}
public static View inflate( Context context, int layoutId )
{
LayoutInflater factory = LayoutInflater.from( context );
return factory.inflate( layoutId, null );
}
public static void setChecked( Activity activity, int id, boolean value )
{
CheckBox cbx = (CheckBox)activity.findViewById( id );