2016-12-30 139 views
0

在我的应用程序中,我想要创建一个UI,它将允许用户输入标题文本和内容文本。但内容文本应该填充屏幕的整个剩余区域,'textBottomType'应该位于屏幕的底部。 我如何确保'textInputContent'将填满整个空白屏幕区域?我用UI做了不同的事情,下面是我的代码。用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

将Edittext的inputType属性设置为textMul tiLine:

android:inputType="textMultiLine" 
+0

我做了更改,这是它的外观。在这个问题中,“输入您的内容”下方的文本是单行文本,但我希望用户在此输入多行文本。我如何让用户输入多行文本,以便整个屏幕可以充满内容文本。 – IamHuM

+0

在主要问题中添加了当前用户界面和预期用户界面的图像。 – IamHuM

+0

我修改后的代码如下图所示 – IamHuM

0

我修改了代码,如下所示。谢谢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" 
      />