我有一个与我的EditText在Android的问题 我想控制的高度,以适应它的内容,但它不工作。Android的EditText不增加,但减少
这是EditText上的配置:
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/txtPublicComment"
android:layout_marginTop="5dp"
android:padding="5dp"
android:maxLength="2000"
android:minLines="8"
android:layout_weight="1"
android:gravity="left|top"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
style="@style/EditTextDarkGreyLightBorder"
/>
而不是越来越大,控制减少他的高度时,我按ENTER键。我不知道为什么。
这是整个片段:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/activity_background"
tools:context="computerland.com.mobilenew.TimeSheetEditFragment">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:fadeScrollbars="true"
android:scrollbarStyle="insideOverlay"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/BoxWhite">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/str_comment"
style="@style/TextViewGreyMediumItalicCaps"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/txtPublicComment"
android:layout_marginTop="5dp"
android:padding="5dp"
android:maxLength="2000"
android:minLines="8"
android:layout_weight="1"
android:gravity="left|top"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
style="@style/EditTextDarkGreyLightBorder"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
任何想法?
相同的结果有或没有layout_weight 1 –