2016-12-30 2 views
0

В моем приложении я хочу создать пользовательский интерфейс, который позволит пользователю вводить текст заголовка и текст контента. Но текст содержания должен заполнять всю оставшуюся область экрана, а текст «textBottomType» должен находиться в нижней части экрана. Как я могу убедиться, что «textInputContent» заполнит всю пустую область экрана? Я пробовал разные вещи с пользовательским интерфейсом, а ниже - мой код.Заполнить всю область экрана TextInputLayout

<?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" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/content_user_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:showIn="@layout/activity_user_view"> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/textInputHeader" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="2dp"> 
       <AutoCompleteTextView 
        android:id="@+id/textInputHeaderInformation" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="Enter Your Header" 
        android:inputType="text" 
        android:maxLines="1" 
        /> 
     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/textInputContent" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/textInputHeader" 
      android:padding="2dp"> 
      <EditText 
       android:id="@+id/textInputContentInformation" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="Enter Your Content" 
       android:inputType="text" 
       android:layout_weight="1" 
       /> 
     </android.support.design.widget.TextInputLayout> 

     <LinearLayout android:orientation="horizontal" android:layout_marginTop="12dp" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@color/background1" 
      android:layout_below="@+id/textBottomType" 
      android:layout_alignParentStart="true"> 
      <ImageView android:src="@android:drawable/ic_popup_reminder" android:layout_margin="@dimen/card_margin" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" /> 
      <TextView android:text="Important Information" 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:textAlignment="center" 
       android:textStyle="normal|bold" 
       android:textColor="@color/winter" 
       android:textSize="18sp" /> 
     </LinearLayout> 
</RelativeLayout> 

Текущий Incorect вид ... Current UI view

И это то, что я хочу, чтобы мой взгляд, чтобы быть ... Expected UI view

Спасибо,

IamHuM

ответ

0

set inputType свойство Edittext to textMul tiLine:

android:inputType="textMultiLine" 
+0

Я вносил изменения, и так оно выглядит. В этой проблеме текст ниже «Введите свой контент» - это текст одной строки, но я хочу, чтобы пользователь вводил в него многострочный текст. Как я могу позволить пользователю вводить многострочный текст, чтобы весь экран мог заполняться текстом контента. – IamHuM

+0

Добавлены изображения для текущего пользовательского интерфейса и ожидаемого интерфейса в главном вопросе. – IamHuM

+0

Я модифицировал код, как показано ниже – IamHuM

0

I модифицированный код, как показано ниже. Спасибо Vivek за ваш быстрый ответ.

 <EditText 
      android:id="@+id/textInputContentInformation" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="Enter Your Notes Content" 
      android:inputType="text|textAutoComplete|textMultiLine|textLongMessage" 
      android:layout_weight="1" 
      android:maxLines="1000" 
      /> 
Смежные вопросы