2017-05-23 3 views
-2

の内側に私のリストビューをスクロールすることはできません。https://ibb.co/fkEAAv私はこれは私のxmlの最初の部分であるscrollview

次にこの1つは、XMLの2番目の部分です:https://ibb.co/hMZGiF

私の問題は、次のとおりです。

  1. リストビューに正しく表示できません。実際には5つのコメント を表示する必要がありますが、コメントは2つしか表示されません。
  2. リストビューをスクロールできません。ここで

XMLコードは次のとおりです。

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/ScrollView01" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fillViewport="true" 
    android:scrollbars="none" > 

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

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="600dp" 
      android:background="@drawable/taskdetails" 
      > 


      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Proceed" 
       android:background="#84B281" 
       android:id="@+id/button15" 
       android:layout_alignParentBottom="true" 
       android:layout_marginBottom="20dp" 
       android:layout_marginRight="10dp" 
       android:layout_marginLeft="10dp" 
       android:layout_alignEnd="@+id/editText24" 
       android:layout_alignStart="@+id/editText24" /> 

      <EditText 
       android:layout_width="400dp" 
       android:layout_height="150dp" 
       android:id="@+id/editText21" 
       android:theme="@style/wat" 
       android:hint="Description" 
       android:inputType="textMultiLine" 
       android:lines="8" 
       android:textColor="#994495" 
       android:minLines="6" 
       android:gravity="top|left" 
       android:maxLines="10" 
       android:enabled="true" 
       android:focusableInTouchMode="false" 
       android:scrollbars="vertical" 
       android:layout_alignParentStart="false" 
       android:layout_marginTop="120dp" 
       android:layout_marginBottom="15dp" 
       android:layout_alignParentEnd="false" 
       android:layout_marginLeft="10dp" 
       android:layout_marginRight="10dp" /> 

      <EditText 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/editText22" 

       android:theme="@style/wat" 
       android:gravity="center" 
       android:textColor="#994495" 
       android:backgroundTint="#994495" 
       android:enabled="true" 
       android:focusableInTouchMode="false" 
       android:scrollbars="vertical" 
       android:hint="When will it start?" 
       android:layout_below="@+id/editText21" 
       android:layout_alignParentStart="false" 
       android:layout_marginLeft="10dp" 
       android:layout_marginRight="10dp" 
       android:layout_marginTop="15dp" /> 

      <EditText 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/editText23" 
       android:theme="@style/wat" 
       android:gravity="center" 
       android:backgroundTint="#994495" 
       android:enabled="true" 
       android:focusableInTouchMode="false" 
       android:scrollbars="vertical" 
       android:hint="When will it end?" 
       android:layout_below="@+id/editText22" 
       android:layout_marginLeft="10dp" 
       android:layout_marginRight="10dp" 
       android:layout_marginTop="20dp" /> 

      <EditText 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/editText24" 
       android:theme="@style/wat" 
       android:backgroundTint="#994495" 
       android:enabled="true" 
       android:focusableInTouchMode="false" 
       android:scrollbars="vertical" 
       android:hint="Any specific time?" 
       android:layout_below="@+id/editText23" 
       android:layout_alignParentStart="false" 
       android:layout_marginLeft="10dp" 
       android:gravity="center" 
       android:layout_marginRight="10dp" 
       android:layout_marginTop="20dp" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Task Schedule:" 
       android:textSize="18dp" 
       android:textColor="#994495" 
       android:id="@+id/textView22" 
       android:layout_centerHorizontal="true" 
       android:layout_marginTop="280dp" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 

       android:textSize="26sp" 
       android:text="Title" 
       android:id="@+id/textView23" 
       android:textColor="#090" 
       android:layout_marginTop="85dp" 
       android:layout_marginLeft="100dp" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="New Text" 
       android:id="@+id/emails" 
       android:visibility="invisible" 
       android:layout_alignParentTop="true" 
       android:layout_toEndOf="@+id/textView22" /> 
     </RelativeLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:orientation="vertical" 
      android:layout_weight="0" 
      android:layout_height="50dp" 
      android:background="@drawable/comments" 
      android:layout_marginBottom="0dp"> 

     </LinearLayout> 
     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="200dp" > 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 

       android:id="@+id/imageView3" /> 

      <ListView 
       android:id="@+id/listView" 
       android:background="#fff" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 

     </LinearLayout> 
    </LinearLayout> 
</ScrollView> 
+0

リニアレイアウトの代わりに相対レイアウトを使用します。 – Satyavrat

+0

ネストされたスクロールビューを使用してみてください – AbhayBohra

+0

親ビューでrelativeLayout、リストビューでスクロールビュー – Kriti

答えて

-1

は、スクロールビューに一つだけの属性を置きます。

スクロールビューでは1つの線形レイアウトに、線形レイアウトでは他のすべての属性に似ています。

0

ScrollViewではなくNestedScrollViewを使用できます。 、ListviewをRecyclerViewに置き換えてください。

あなたはhere

から例を見つけることができますNestedScrollViewはちょうどScrollViewのようですが、それは、Androidの新バージョンと旧バージョンの両方でネストされたスクロール親と子の両方として機能をサポートしています。ネストされたスクロールはデフォルトで有効になっています。あなたのLinearLayoutで

0

は、ScrollViewの子は、 アンドロイドを変更:layout_height = "match_parentを" アンドロイドに:layout_height = "wrap_contentを"。

これは、このコンテナを画面より大きくします。

残念ながら、ScrollViewで垂直方向のスライドコンポーネントを使用することは決して良い考えではありません。 ListViewにlayout_heightを設定してデータが入力されていない場合は、findviewbyid(R.id.xxx).addView(adapter.getView(...))のように手動でコメントを追加してみてください。 もちろん、それは実際のコードではありませんが、それがアイデアです。

関連する問題