In android we can create Edittext with multiple lines using below code in Layout
<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="@android:color/black"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Multiline EditText"
android:textColor="@android:color/white" />
<EditText
android:id="@+id/editext"
android:layout_width="fill_parent"
android:layout_height="150dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="10dip"
android:ems="150"
android:gravity="left|top"
android:hint="Please provide your comments here."
android:inputType="textMultiLine|textCapSentences"
android:padding="5dip"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:textSize="20sp" >
</EditText>
</LinearLayout>
Output Screen :
<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="@android:color/black"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Multiline EditText"
android:textColor="@android:color/white" />
<EditText
android:id="@+id/editext"
android:layout_width="fill_parent"
android:layout_height="150dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="10dip"
android:ems="150"
android:gravity="left|top"
android:hint="Please provide your comments here."
android:inputType="textMultiLine|textCapSentences"
android:padding="5dip"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:textSize="20sp" >
</EditText>
</LinearLayout>
Output Screen :
No comments:
Post a Comment