2016-11-19 7 views
0

親LinearLayout内でTableLayoutを使用していますが、TableLayoutにはいくつかのEditTextビューがあります。壊れたAndroidレイアウト

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/activity_view_edit_location_parameters" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="com.kg.hvacloadestimator.ViewEditLocationParameters"> 

     <TextView 
      android:text="@string/Location" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/location" /> 

     <TextView 
      android:text="@string/Summer_Outside_db" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/summerDB" /> 

     <TextView 
      android:text="@string/Winter_Outside_db" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/winterDB" /> 

     <TextView 
      android:text="@string/Daily_Range" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/dailyRange" /> 

     <CheckBox 
      android:text="@string/Checkbox_Custom_Conditions" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:onClick="onCheckboxClicked" 
      android:id="@+id/checkBoxCustomConditions" /> 

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

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

         <TextView 
          android:text="@string/Custom_Location" 
          android:layout_height="wrap_content" 
          android:id="@+id/textViewCustomLocation" /> 

         <EditText 

          android:layout_height="wrap_content" 
          android:inputType="textPersonName" 
          android:text="@string/Default_Custom_Location" 
          android:ems="10" 
          android:id="@+id/editTextCustomLocation" /> 
       </TableRow> 

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

         <TextView 
          android:text="@string/Custom_Summer_db" 
          android:layout_height="wrap_content" 
          android:id="@+id/textViewCustomSummerDB" /> 

         <EditText 

          android:layout_height="wrap_content" 
          android:inputType="numberSigned|numberDecimal" 
          android:ems="10" 
          android:id="@+id/editTextCustomSummerDB" 
          android:text="@string/Default_Custom_Summer_db" /> 
       </TableRow> 

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

         <TextView 
          android:text="@string/Custom_Winter_db" 
          android:layout_height="wrap_content" 
          android:id="@+id/textViewCustomWinterDB" /> 

         <EditText 

          android:layout_height="wrap_content" 
          android:inputType="numberSigned|numberDecimal" 
          android:ems="10" 
          android:id="@+id/editTextCustomWinterDB" 
          android:text="@string/Default_Custom_Winter_db" /> 
       </TableRow> 

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

         <TextView 
          android:text="@string/Custom_Daily_Range" 
          android:layout_height="wrap_content" 
          android:id="@+id/textView4" /> 

         <Spinner 
          android:layout_height="wrap_content" 
          android:id="@+id/spinnerCustomDailyRange" /> 
       </TableRow> 
     </TableLayout> 

     <Button 
      android:text="@string/Button_Confirm_Location" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:onClick="onButtonClick" 
      android:id="@+id/buttonConfirmLocation" /> 

</LinearLayout> 

すべてのヘルプ:ここ

enter image description here

は私のXMLコードです:私は、次の画像に見られるようなのEditTextビューは私のレイアウトの画面サイズを超えた理由として完全な損失で午前感謝されます。前もって感謝します。

答えて

0

これらの要素の幅も太さも設定していないためです。幅をwrap_contentに設定し、希望する値になるまでweightの値で試してみてください。また、LinearLayoutと重量についてさらに明確にするには、this questionをチェックしてください。

EDIT

TextViewsとのEditTextのems性質は、同様のレイアウトに影響を与えます。あなたが同じ比率でそれらをしたい場合は、両方で同じを使用してください。

+0

それはレイアウトを台無しにしていた 'ems'プロパティでした。ありがとうございました! – KJG

関連する問題