In general, we want to achieve the effect of one is very simple:
two edittext to take care of one:
but we want the second edittext to fill the rest of the space. such as two
Two:
Solve:
The Android:fillviewport in ScrollView is set to true using the ScrollView nested linearlayout.
Analysis:
When the elements in the ScrollView want to fill ScrollView, using "fill_parent" is not useful and must be set to ScrollView: Android:fillviewport= "true".
When ScrollView does not fillveewport= "true", the elements inside (such as linearlayout) are calculated according to the wrap_content (whether or not it is set to "Fill_parent"), And if the elements of the LinearLayout set fill_parent, then it is no use, because the linearlayout depends on the elements inside, and the elements in the linearlayout, such contradictions. So the inside element is set to Fill_ The parent will also be counted as wrap_content.
Source: http://blog.sina.com.cn/s/blog_6cf2ea6a0102v61f.html
The code follows, commenting on the commonly used EditText properties:
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
Key points ********
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/edit_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|left"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@null"
Control background, not here, refers to transparent
android:ellipsize="end"
Auto-hide trailing overflow data, typically used for long lines of text when the line cannot be displayed all
android:hint="添加标题"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:singleLine="true"
Force input on a single line
android:textColorHint="#bfbfbf" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/dotted_line"
android:layerType="software" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<EditText
android:id="@+id/edit_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:gravity="left|top"
Cursor in upper left corner when input
android:hint="内容"
android:lineSpacingExtra="4.6dp"
Set line spacing
android:scrollbars="vertical"
Set scroll bar display
android:textColorHint="#bfbfbf"
android:textSize="16sp" />
</RelativeLayout>
<!--
android:background="@null"
Remove the EditView border
android:inputType="textMultiLine"
can display multiple lines
android:minLines="6"
Set the minimum number of lines of text
-->
</LinearLayout>
</ScrollView>
From for notes (Wiz)
Solve the problem that edittext can't fill full screen and edittext the attributes you should know