2016-12-23 8 views
1
<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:id="@+id/linearLayoutUser" 
    > 

<!-- TODO: Update blank fragment layout --> 

<ExpandableListView 
    android:id="@+id/expandableListView" 

    android:layout_width="match_parent" 
    android:layout_alignParentTop="true" 
    android:groupIndicator="@null" 
    android:layout_gravity="left|top" 
    android:layout_weight="1" 



    /> 

//このコードの下に表示されている //以下見えないscrollview下のレイアウトは展開できません。 //コードのみ上記

適切 android:layout_weightandroid:layout_height値を設定 ​​

答えて

2

内部の詳細情報です。

<LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:id="@+id/linearLayoutUser"> 

      <ExpandableListView 
      android:id="@+id/expandableListView" 
      android:layout_height="0dp" 
      android:layout_width="match_parent" 
      android:layout_alignParentTop="true" 
      android:groupIndicator="@null" 
      android:layout_gravity="left|top" 
      android:layout_weight="1"/>  

     <ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_gravity="center" 
      android:layout_weight="1" 
      android:fillViewport="true"> 
     // your work 
    </ScrollView> 
</LinearLayout> 
+0

... –

+0

ありがとうbtはまだ動作していません。 –

0
にあなたのXMLを変更し

:重量のために使用されている二つの性質があります

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/linearLayoutUser" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <ExpandableListView 
     android:id="@+id/expandableListView" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_gravity="left|top" 
     android:layout_weight="1" 
     android:groupIndicator="@null" /> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:fillViewport="true"> 

     <!--Scroll view with only one direct child--> 

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

      <!--Do your work here--> 

     </LinearLayout> 
    </ScrollView> 

</LinearLayout> 
+0

いいえ....しかし、ありがとう!!! –

0

。 1)は、あなたがこのレイアウト内で使用している重みの合計額であるlayout_weightsumを設定する必要があり、コンテナ/親(lineaLayout)で
2)weightsum

をlayout_weight。

ここでは、2つのアイテムを持つ線形レイアウトがあり、両方のアイテムの高さが同じでなければなりません。

合計2を設定し、レイアウトごとに、各子レイアウトの重みを1に設定します。

希望すると助かります!

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/linearLayoutUser" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:weightSum="2"> 

    <ExpandableListView 
     android:id="@+id/expandableListView" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_gravity="left|top" 
     android:layout_weight="1" 
     android:groupIndicator="@null" /> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:fillViewport="true" 
     android:layout_weight="1"> 

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

      <!--Add your other part which you want to show in ScrollView--> 

     </LinearLayout> 
    </ScrollView> 
</LinearLayout> 
関連する問題