2013-08-14 2 views
0

Я разрабатываю форму для приложения. Я добавил некоторые поля Textview с шириной, установленной в «wrap to content», но в любом случае я пытаюсь изменить ширину размера Textview всегда больше, чем содержимое , Даже при использовании графического макета Android он не позволяет мне изменять размеры TextViews и EditText.Android TextView не обертывает текст

Вот макет XML:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:background="#0099cc" 
    tools:context=".ModuloAlfa" > 

    <!-- 
     The primary full-screen view. This can be replaced with whatever view 
     is needed to present your content, e.g. VideoView, SurfaceView, 
     TextureView, etc. 
    --> 

    <TextView 
     android:id="@+id/fullscreen_content" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="center" 
     android:keepScreenOn="true" 
     android:text="@string/dummy_content" 
     android:textColor="#33b5e5" 
     android:textSize="50sp" 
     android:textStyle="bold" /> 

    <!-- 
     This FrameLayout insets its children based on system windows using 
     android:fitsSystemWindows. 
    --> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:orientation="vertical" > 

     <TableLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" > 

      <TableRow 
       android:id="@+id/tableRow2" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

       <TextView 
        android:id="@+id/editText1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:ems="10" 
        android:text="@string/NModulo" /> 

       <EditText 
        android:id="@+id/ModuleNumber" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:ems="18" 
        android:hint="@string/ModuleNumber" 
        android:inputType="numberSigned" /> 
      </TableRow> 

      <TableRow 
       android:id="@+id/tableRow3" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

       <TextView 
        android:id="@+id/editText2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:ems="10" 
        android:text="@string/Del" /> 

       <EditText 
        android:id="@+id/DocDate" 
        android:layout_width="158dp" 
        android:layout_height="wrap_content" 
        android:ems="18" 
        android:focusable="false" 
        android:hint="@string/DocDate" 
        android:inputType="date" /> 
      </TableRow> 

      <TableRow 
       android:id="@+id/tableRow4" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

       <TextView 
        android:id="@+id/editText3" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:ems="10" 
        android:text="@string/Impianto" /> 

       <Spinner 
        android:id="@+id/Impianto" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" /> 
      </TableRow> 

      <TableRow 
       android:id="@+id/tableRow1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" > 

       <TextView 
        android:id="@+id/textView1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/SiteManager" /> 

       <Spinner 
        android:id="@+id/SiteManager" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:entries="@array/SiteManagers" /> 
      </TableRow> 

      <TableRow 
       android:id="@+id/tableRow5" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

       <TextView 
        android:id="@+id/textView2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/LavoriAttivita" /> 
      </TableRow> 

      <TableRow 
       android:id="@+id/tableRow7" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

       <EditText 
        android:id="@+id/editText4" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:ems="10" 
        android:inputType="textMultiLine" /> 
      </TableRow> 

      <TableRow 
       android:id="@+id/tableRow6" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

       <TextView 
        android:id="@+id/textView3" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/AffidatiAllImpresa" /> 
      </TableRow> 

      <TableRow 
       android:id="@+id/tableRow8" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

       <EditText 
        android:id="@+id/editText5" 
        android:layout_width="138dp" 
        android:layout_height="wrap_content" 
        android:ems="10" /> 
      </TableRow> 

      <TableRow 
       android:id="@+id/tableRow9" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

       <TextView 
        android:id="@+id/textView4" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/SubappaltoDi" 
        android:visibility="visible" /> 
      </TableRow> 

      <TableRow 
       android:id="@+id/tableRow10" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

       <EditText 
        android:id="@+id/editText6" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:ems="10" /> 
      </TableRow> 

      <TableRow 
       android:id="@+id/tableRow11" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

       <TextView 
        android:id="@+id/textView5" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/EsitoVitep" /> 

       <RadioButton 
        android:id="@+id/radioButton1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Si" /> 

       <RadioButton 
        android:id="@+id/radioButton2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="No" /> 
      </TableRow> 
     </TableLayout> 
    </LinearLayout> 

</FrameLayout> 

Спасибо заранее, Ивано

ответ

0

Ваши тексты, которые должны написать в TextViews есть пробел между словами? Иногда разработчики используют образцы, такие как aaaaaaaaaaaaaa для тестирования, и забыли , чтобы заменить их на реальные образцы данных.

+0

Все они являются единственными словами, например, даже если содержание TextView равно «1», «оно охватывает половину экрана. –

Смежные вопросы