2017-10-20 120 views
0

我想管理多行编辑文本控件相对于设备屏幕高度的高度。高度应该是屏幕的40%。xamarin android如何通过屏幕高度增加多行编辑文本高度?

我已经使用了最大线条,线条和最小线条属性。如果我设置了这些属性,那么高度确实会改变,但是如果屏幕高度改变或者设备转移到水平,那么编辑文本将不在屏幕上。总之,多行编辑文本高度必须是动态的,并且屏幕大小。它应该随着屏幕尺寸的其他控制而缩小和扩大。

截图:

enter image description here

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:focusableInTouchMode="true" 
android:background="#e8eeff"> 
<EditText 
    android:id="@+id/etTextMultiLine" 
    android:inputType="textMultiLine" 
    android:gravity="top|left" 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent" 
    android:scrollbars="vertical" 
    android:hint="Enter a Text" 
    android:background="@layout/EditTextStyle" 
    android:textColorHint="#404144" 
    android:textColor="#404144" 
    android:layout_marginLeft="5dp" 
    android:layout_marginRight="5dp" 
    android:layout_marginTop="5dp" 
    android:padding="5dp" /> 

回答

0

既然你想用百分比来实现大小,可以考虑使用PercentFrameLayout作为您的EditText的父母,只是同时匹配的体重和身高。该文档说PercentFrameLayout已被弃用,因此请考虑建议的替换,ConstraintLayout。