2017-12-28 30 views
0

以下のxmlは、水平スクロールビュー内にリストビューを表示することについてです。それはタブレットではうまく動作します。私はLenovo Tab7の必須テストとSamsung Galaxy 10インチをテストしました。しかし、デバイスが7インチ以下になると、そのスローエラーが発生します。助けてくださいXmlはタブレットで動作しますが、7インチ未満のデバイスでは機能しません。

android.view.InflateException:バイナリXMLファイル行#0:バイナリXMLファイル行#0:layout_height属性を指定する必要があります。

<?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

てみを参照してください次元ごとに定義するためにここに

android:layout_height="@dimen/headerheight" 

を使用しているとして、あなたはすべての次元のheaderheightを与えているかどうかを確認モバイルのための 'dimens.xml'ファイルを確認してください。おそらく値は** 100 dp **の代わりに** 100 ** **です。 –

+0

私はすでに錠剤で正しく動作することを確認しています。 –

+0

タブレット向けの 'dimens.xml'をモバイル向けに置き換えてみてください。モバイル用の 'dimens.xml'のどこかに構文が間違っているというエラーがなければ。 –

答えて

0

チェックして、この

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

+0

はい、私は大型、大型のためのdimensを与えていると私は通常のバージョンにいくつかのdimensコンポーネントを追加することを逃した –

関連する問題