我的程序有一个消息部分。所以,我设计了一个具有9个补丁背景的edittext。我的问题是我希望我的edittext只能垂直增长。我怎么能这样做?
我的消息部分看起来像这样:
消息
它是xml:
<EditText
android:id="@+id/editText2"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:hint="Write something..."
android:imeOptions="actionNone"
android:textSize="15dp"
android:textStyle="bold"
android:allowUndo="false"
android:inputType="textCapSentences"
android:background="@drawable/back_messaging" />`
&#34; back_messaging&#34;是一个9补丁图像,看起来像: 9-patch
答案 0 :(得分:0)
您可以使用已经提到的9补丁图像。使用singleLine=false
并将图像上的左侧黑色斑点放在像素上,该像素可以在不干扰上部的情况下拉伸图像。就像你在back_messaging中所做的一样。