Android UI How to - EditText Capitalize








You can set EditText to textCapWords to have the control capitalize words.

Example

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">
/*from w  w w.j  a v a  2 s . c  o m*/
    <EditText
        android:id="@+id/myEditText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="textCapWords" />

</LinearLayout>

Java code

package com.java2s.app;
/*from w  w  w  . ja v  a2s .  c  o m*/
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends Activity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

    }

}
null