2012-01-04 7 views
0

この小さな問題について質問するのは本当に好きではありませんが、数時間digginした後は枯れてしまいます。新しい行を追加する前にEditTextに文字が入力されていない

AndroidのEditTextに問題があります。それは非常に基本的であり、スタイルはそれに適用されません。

問題があるのは、最後の最大幅に達したときに改行を追加するのではなく、EditTextの幅を魔法のように「拡大」して、実際に新しいライン。明らかに、それらの10〜12文字はすべて「見えない」。私は本当になぜこれが起こっているのかわからない、どんな助けも大歓迎!ここで

は私のレイアウトです:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:gravity="center_horizontal" 
    android:background="@drawable/fondo_localizacion"> 

    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:layout_margin="5dp" 
     android:stretchColumns="1"> 

     <TableRow > 
     <TextView 
    android:id="@+id/locationNameLabel" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       style="@style/LabelLocalizacion" 
       android:gravity="center_vertical" 
       android:text="@string/nombre_label"> 
      </TextView> 
      <EditText 
       android:id="@+id/locationName" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       > 
      </EditText>  
     </TableRow> 
     <!-- La segunda fila tiene el par desc y su valor --> 
     <TableRow > 
      <TextView 
       android:id="@+id/locationDescLabel" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       style="@style/LabelLocalizacion" 
       android:gravity="center_vertical" 
       android:text="@string/desc_label"> 
      </TextView> 
      <EditText 
       android:id="@+id/locationDesc" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       > 
      </EditText>  
     </TableRow> 

     <TableRow > 
      <TextView 
       android:id="@+id/locationPicLabel" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       style="@style/LabelLocalizacion" 
       android:gravity="center_vertical" 
       android:text="@string/imagen_label"> 
      </TextView> 
     </TableRow> 
</TableLayout> 
+0

どのEditTextに問題がありますか? – Ian

+0

私は両方のためにそれを持っていた、残念なことに、@ loksのソリューションは素晴らしい仕事、とにかく尋ねてくれてありがとう:) – AlejandroVK

答えて

1

:stretchColumns =「1」からtablelayoutとあなたが後に修正このレイアウトを使用することができます1へのEditTextの重みを置く

  <TableRow 
     android:layout_width="fill_parent" 
      android:layout_height="wrap_content" > 

     <TextView 
     android:id="@+id/locationNameLabel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:gravity="center_vertical" 
     android:text="gfg" > 
     </TextView> 

    <EditText 
     android:id="@+id/locationName" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:hint="hjhj" > 
     </EditText> 
    </TableRow> 
    <!-- La segunda fila tiene el par desc y su valor --> 

     <TableRow 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 

     <TextView 
     android:id="@+id/locationDescLabel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:gravity="center_vertical" 
     android:text="yuiuy" > 
     </TextView> 

    <EditText 
     android:id="@+id/locationDesc" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" > 
    </EditText> 
</TableRow> 

<TableRow 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" > 

    <TextView 
     android:id="@+id/locationPicLabel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:gravity="center_vertical" 
     android:text="" > 
    </TextView> 
</TableRow> 

+0

これは素晴らしい感謝を働いた! – AlejandroVK

0

は、表の行のタグ削除アンドロイドに高さと幅を与えるようにしてください一定の数値幅でのEditTextを作ってみましょうというよりもwrap_content

関連する問題