2017-12-28 25 views
0

My Xml unten ist über eine ListView in einem horizontalen scrollview. Es funktioniert gut in Tabletten, die ich Lenovo Tab7 essential und Samsung Galaxy 10 Zoll getestet habe. Aber wenn es um Geräte mit weniger als 7 Zoll geht, werfen sie Fehler. help meXml funktioniert in Tabletten, funktioniert aber nicht für Geräte weniger als 7 Zoll

android.view.InflateException: Binär XML-Datei Zeile # 0: Binär XML-Datei Zeile # 0: Sie müssen ein Layout_Height-Attribut angeben.

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" 
android:verticalScrollbarPosition="right"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="@dimen/headerheight" 
    android:background="#dc5E4485" 
    android:orientation="horizontal" 
    android:weightSum="1"> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_weight=".1" 
     android:gravity="center_vertical|left" 
     android:paddingLeft="3sp" 
     android:text="@string/app_name" 
     android:textColor="@color/white" 
     android:textSize="25sp" 
     android:textStyle="bold" /> 

    <ImageView 
     android:id="@+id/next_tableView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="3sp" 
     android:layout_marginRight="6sp" 
     android:layout_marginTop="3sp" 
     android:layout_weight=".9" 
     android:src="@drawable/next" 
     android:text="Next" /> 

</LinearLayout> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal"> 

    <LinearLayout 
     android:id="@+id/linearlayout" 
     android:layout_width="@dimen/column_width_min" 
     android:layout_height="match_parent" 
     android:background="@color/white" 
     android:orientation="vertical" 
     android:weightSum="1"> 

     <TextView 
      android:id="@+id/textView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_weight=".30" 
      android:background="@drawable/thin_line_border" 
      android:gravity="center" 
      android:singleLine="true" 
      android:text="Select" 
      android:textSize="@dimen/textsize" /> 

     <TextView 
      android:layout_width="@dimen/column_width_min" 
      android:layout_height="match_parent" 
      android:layout_weight=".31" 
      android:gravity="center" 
      android:singleLine="true" 
      android:text="S.No" 
      android:textSize="@dimen/textsize" 
      android:textStyle="bold" /> 

     <ListView 
      android:id="@+id/inventoryItemList1" 
      android:layout_width="210dp" 
      android:layout_height="match_parent" 
      android:layout_weight=".09" 
      android:background="@drawable/thin_line_border" 
      android:divider="@null"> 

     </ListView> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_weight=".30" 
      android:background="@color/white" 
      android:gravity="bottom"> 

      <Button 
       android:id="@+id/save_tableView" 
       android:layout_width="match_parent" 
       android:layout_height="50dp" 
       android:background="@drawable/thick_line_border" 
       android:gravity="center" 
       android:text="Save" /> 
     </LinearLayout> 


    </LinearLayout> 

    <HorizontalScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_toEndOf="@+id/linearlayout" 
     android:scrollbarAlwaysDrawVerticalTrack="false"> 

     <RelativeLayout 
      android:id="@+id/relativeLayout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <LinearLayout 
       android:id="@+id/tableviewlayout" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical" 
       android:weightSum="1"> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_weight=".30" 
        android:background="@color/white" 
        android:orientation="horizontal"> 

        <LinearLayout 
         android:layout_width="@dimen/column_width_twice" 
         android:layout_height="match_parent" 
         android:orientation="vertical" 
         android:weightSum="2"> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_weight="1" 
          android:background="@drawable/background_button_ghost" 
          android:gravity="center" 
          android:singleLine="true" 
          android:text="Accessories short supply" 
          android:textSize="@dimen/textsize" 
          android:textStyle="bold" /> 

         <Spinner 
          android:prompt="@string/spinner_title" 
          android:id="@+id/spinner1" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_weight="1" 
          android:background="@drawable/background_button_ghost" 
          android:gravity="center" 
          android:textSize="@dimen/textsize" /> 

        </LinearLayout> 

        <LinearLayout 
         android:layout_width="@dimen/column_width_twice" 
         android:layout_height="match_parent" 
         android:orientation="vertical" 
         android:weightSum="2"> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_weight="1" 
          android:background="@drawable/background_button_ghost" 
          android:gravity="center" 
          android:singleLine="true" 
          android:text="Improper Lugging" 
          android:textSize="@dimen/textsize" 
          android:textStyle="bold" /> 

         <Spinner 
          android:prompt="@string/spinner_title" 
          android:id="@+id/spinner2" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_weight="1" 
          android:background="@drawable/background_button_ghost" 
          android:gravity="center" 
          android:textSize="@dimen/textsize" /> 

        </LinearLayout> 

        <LinearLayout 
         android:layout_width="@dimen/column_width_twice" 
         android:layout_height="match_parent" 
         android:orientation="vertical" 
         android:weightSum="2"> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_weight="1" 
          android:background="@drawable/background_button_ghost" 
          android:gravity="center" 
          android:text="Cell Bypass(or)Reverse polarity" 
          android:textSize="@dimen/textsize" 
          android:textStyle="bold" /> 

         <Spinner 
          android:prompt="@string/spinner_title" 
          android:id="@+id/spinner3" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_weight="1" 
          android:background="@drawable/background_button_ghost" 
          android:gravity="center" 
          android:textSize="@dimen/textsize" /> 

        </LinearLayout> 

        <LinearLayout 
         android:layout_width="@dimen/column_width_twice" 
         android:layout_height="match_parent" 
         android:orientation="vertical" 
         android:weightSum="2"> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_weight="1" 
          android:background="@drawable/background_button_ghost" 
          android:gravity="center" 
          android:singleLine="true" 
          android:text="Add Leakage/ Over Charge" 
          android:textSize="@dimen/textsize" 
          android:textStyle="bold" /> 

         <Spinner 
          android:prompt="@string/spinner_title" 
          android:id="@+id/spinner4" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_weight="1" 
          android:background="@drawable/background_button_ghost" 
          android:gravity="center" 
          android:textSize="@dimen/textsize" /> 

        </LinearLayout> 

        <LinearLayout 
         android:layout_width="@dimen/column_width_twice" 
         android:layout_height="match_parent" 
         android:orientation="vertical" 
         android:weightSum="2"> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_weight="1" 
          android:background="@drawable/background_button_ghost" 
          android:gravity="center" 
          android:singleLine="true" 
          android:text="Improper Connection &amp;mixing of Other make capacity cells" 
          android:textSize="@dimen/textsize" 
          android:textStyle="bold" /> 

         <Spinner 
          android:prompt="@string/spinner_title" 
          android:id="@+id/spinner5" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_weight="1" 
          android:background="@drawable/background_button_ghost" 
          android:gravity="center" 
          android:textSize="@dimen/textsize" /> 

        </LinearLayout> 

       </LinearLayout> 

       <LinearLayout 
        android:id="@+id/assetTitleLayout" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_gravity="center" 
        android:layout_weight=".31" 
        android:background="#3a5E4485" 
        android:orientation="horizontal"> 

        <TextView 
         android:id="@+id/textView1" 
         android:layout_width="@dimen/column_width" 
         android:layout_height="match_parent" 
         android:background="@drawable/background_button_ghost" 
         android:gravity="center" 
         android:singleLine="true" 
         android:text="Cell SL.Nos" 
         android:textSize="@dimen/textsize" 
         android:textStyle="bold" /> 

        <TextView 
         android:id="@+id/textView2" 
         android:layout_width="@dimen/column_width" 
         android:layout_height="match_parent" 
         android:background="@drawable/background_button_ghost" 
         android:gravity="center" 
         android:singleLine="true" 
         android:text="MFG DT" 
         android:textSize="@dimen/textsize" 
         android:textStyle="bold" /> 

        <TextView 
         android:id="@+id/textView3" 
         android:layout_width="@dimen/column_width" 
         android:layout_height="match_parent" 
         android:background="@drawable/background_button_ghost" 
         android:gravity="center" 
         android:singleLine="true" 
         android:text="OCV(or)ON Charge(v)" 
         android:textSize="@dimen/textsize" 
         android:textStyle="bold" /> 


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

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

          <TextView 
           android:layout_width="match_parent" 
           android:layout_height="match_parent" 
           android:background="@drawable/background_button_ghost" 
           android:gravity="center" 
           android:singleLine="true" 
           android:text="Discharge Reading" 
           android:textSize="@dimen/textsize" 
           android:textStyle="bold" /> 
         </LinearLayout> 

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

          <TextView 
           android:id="@+id/textView4" 
           android:layout_width="@dimen/column_width" 
           android:layout_height="match_parent" 
           android:background="@drawable/background_button_ghost" 
           android:gravity="center" 
           android:singleLine="true" 
           android:text="15 min" 
           android:textSize="@dimen/textsize" 
           android:textStyle="bold" /> 

          <TextView 
           android:id="@+id/textView5" 
           android:layout_width="@dimen/column_width" 
           android:layout_height="match_parent" 
           android:background="@drawable/background_button_ghost" 
           android:gravity="center" 
           android:singleLine="true" 
           android:text="30 min" 
           android:textSize="@dimen/textsize" 
           android:textStyle="bold" /> 

          <TextView 
           android:id="@+id/textView6" 
           android:layout_width="@dimen/column_width" 
           android:layout_height="match_parent" 
           android:background="@drawable/background_button_ghost" 
           android:gravity="center" 
           android:singleLine="true" 
           android:text="1.00 Hr" 
           android:textSize="@dimen/textsize" 
           android:textStyle="bold" /> 

          <TextView 
           android:id="@+id/textView7" 
           android:layout_width="@dimen/column_width" 
           android:layout_height="match_parent" 
           android:background="@drawable/background_button_ghost" 
           android:gravity="center" 
           android:singleLine="true" 
           android:text="1.30 Hr" 
           android:textSize="@dimen/textsize" 
           android:textStyle="bold" /> 

          <TextView 
           android:id="@+id/textView8" 
           android:layout_width="@dimen/column_width" 
           android:layout_height="match_parent" 
           android:background="@drawable/background_button_ghost" 
           android:gravity="center" 
           android:singleLine="true" 
           android:text="2.00 Hrs" 
           android:textSize="@dimen/textsize" 
           android:textStyle="bold" /> 
         </LinearLayout> 

        </LinearLayout> 

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

         <LinearLayout 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_weight="1" 
          android:background="@drawable/background_button_ghost" 
          android:orientation="horizontal"> 

          <TextView 
           android:layout_width="match_parent" 
           android:layout_height="match_parent" 
           android:background="@drawable/background_button_ghost" 
           android:gravity="center" 
           android:singleLine="true" 
           android:text="Charge Reading" 
           android:textSize="@dimen/textsize" 
           android:textStyle="bold" /> 
         </LinearLayout> 

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

          <TextView 
           android:id="@+id/textView9" 
           android:layout_width="@dimen/column_width" 
           android:layout_height="match_parent" 
           android:background="@drawable/background_button_ghost" 
           android:gravity="center" 
           android:singleLine="true" 
           android:text="30 Min" 
           android:textSize="@dimen/textsize" 
           android:textStyle="bold" /> 

          <TextView 
           android:id="@+id/textView10" 
           android:layout_width="@dimen/column_width" 
           android:layout_height="match_parent" 
           android:background="@drawable/background_button_ghost" 
           android:gravity="center" 
           android:singleLine="true" 
           android:text="1.00 Hr" 
           android:textSize="@dimen/textsize" 
           android:textStyle="bold" /> 
         </LinearLayout> 
        </LinearLayout> 
       </LinearLayout> 

       <ListView 
        android:id="@+id/inventoryItemList" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_weight=".09" 
        android:divider="@null"></ListView> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_weight=".30" 
        android:background="@color/white" 
        android:orientation="vertical" 
        android:weightSum="1"> 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:layout_weight=".5"> 

         <TextView 
          android:layout_width="@dimen/column_width_twice" 
          android:layout_height="match_parent" 
          android:gravity="center" 
          android:paddingLeft="2dp" 
          android:text="Total Voltage:(V)" 
          android:textColor="@color/black" 
          android:textSize="@dimen/textsize" /> 

         <TextView 
          android:id="@+id/et_Vtotal1" 
          android:layout_width="@dimen/column_width" 
          android:layout_height="match_parent" 
          android:background="@drawable/background_button_ghost" 
          android:text="" /> 

         <TextView 
          android:id="@+id/et_Vtotal2" 
          android:layout_width="@dimen/column_width" 
          android:layout_height="match_parent" 
          android:background="@drawable/background_button_ghost" 
          android:text="" /> 

         <TextView 
          android:id="@+id/et_Vtotal3" 
          android:layout_width="@dimen/column_width" 
          android:layout_height="match_parent" 
          android:background="@drawable/background_button_ghost" 
          android:text="" /> 

         <TextView 
          android:id="@+id/et_Vtotal4" 
          android:layout_width="@dimen/column_width" 
          android:layout_height="match_parent" 
          android:background="@drawable/background_button_ghost" 
          android:text="" /> 

         <TextView 
          android:id="@+id/et_Vtotal5" 
          android:layout_width="@dimen/column_width" 
          android:layout_height="match_parent" 
          android:background="@drawable/background_button_ghost" 
          android:text="" /> 

         <TextView 
          android:id="@+id/et_Vtotal6" 
          android:layout_width="@dimen/column_width" 
          android:layout_height="match_parent" 
          android:background="@drawable/background_button_ghost" 
          android:text="" /> 

         <TextView 
          android:id="@+id/et_Vtotal7" 
          android:layout_width="@dimen/column_width" 
          android:layout_height="match_parent" 
          android:background="@drawable/background_button_ghost" 
          android:text="" /> 

         <TextView 
          android:id="@+id/et_Vtotal8" 
          android:layout_width="@dimen/column_width" 
          android:layout_height="match_parent" 
          android:background="@drawable/background_button_ghost" 
          android:text="" /> 

        </LinearLayout> 

       </LinearLayout> 

      </LinearLayout> 
     </RelativeLayout> 
    </HorizontalScrollView> 

</LinearLayout> 

+0

Try Überprüfen Sie Ihre Datei 'dimens.xml' für Handys. Vielleicht ist ein Wert ** 100 ** statt ** 100dp ** oder so ähnlich. –

+0

Ich habe bereits überprüft, dass sie richtig zugeordnet wurden in dp es funktioniert in Tabletten –

+0

Versuchen Sie, "dimens.xml" für mobile von dem einen für Tablet zu ersetzen. Wenn es keinen Fehler gibt, bedeutet das, dass irgendwo in "dimens.xml" für Handys eine falsche Syntax vorliegt. –

Antwort

0

prüfen und sehen, ob Sie header für alle Dimensionen gegeben haben, wie Sie sind hier

android:layout_height="@dimen/headerheight" 

zu definieren, indem für jede Dimension dieses siehe

https://stackoverflow.com/a/32861248/5608448

+0

Ja, ich habe es gegeben, ich habe die Dimensionen für große, x-große gegeben und ich habe es vermisst einige Dimens Komponenten zu der normalen Version hinzuzufügen –

Verwandte Themen