2013-10-30 47 views
0

我有一个EditText并且没有多行显示,没有出现错误的地方,谢谢你所显示的兴趣。 我喜欢 “的EditText”:Edittext not show multiline

线1 ==> s_p1

线2 ==> s_p2

线3 ==> s_postre

XML

<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="2dip" > 

     <Button 
      android:id="@+id/bt_comida" 
      android:layout_width="0dip" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:layout_weight="0.15" 
      android:background="@drawable/ic_comida" /> 

     <EditText 
      android:id="@+id/et_com" 
      android:layout_width="0dip" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.85" 
      android:clickable="true" 
      android:cursorVisible="false" 
      android:gravity="top|left" 
      android:inputType="textMultiLine" 
      android:singleLine="false" 
      android:hint="@string/tv_com" 
      android:textColor="@color/Black" 
      android:textSize="14sp" 
      android:textStyle="bold" /> 
    </LinearLayout> 

CODE

String s_union = s_p1 + "\n" + s_p2 + "\n" + s_postre; 
et_com.setText(s_union); 
+0

为什么EditText宽度在这里为零? –

+0

谢谢你的回复。这个血清错误。他会验证它 – d2000k

+0

android:layout_width =“wrap_content”。它给出了相同的错误 – d2000k

回答

0

我没有得到你想说的是什么。你想在你的编辑文本中多行吗? 然后您将以下行添加到您的EditText。

 android:maxLines="any number" 
+0

我想要做的是垂直EditText与多行。感谢您的回答,现在我正在测试 – d2000k