2016-01-14 3 views
0

Я пытаюсь прокрутить список, чей идентификатор является list.I попробовать почти все решения, но отметить работу для меня. Я пытаюсь поместить Relative layout внутри прокрутки, но это также не работайте для меня. Я также пытаюсь поместить список в прокрутку, но он также не работает.Почему listview не прокручивается внутри Относительная компоновка

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/chat_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
> 
<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 
<RelativeLayout 
    android:id="@+id/head" 
    android:background="@color/primary_dark" 
    android:layout_width="fill_parent" 
    android:layout_height="75dp"> 

    <TextView 
     android:padding="15dp" 
     android:id="@+id/grp_heading" 
     android:textStyle="bold" 
     android:textSize="18sp" 
     android:textColor="@android:color/white" 
     android:maxLines="1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 

</RelativeLayout> 

<ListView 
    android:layout_below="@+id/head" 
    android:id="@+id/list" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:divider="@color/white" 
    android:dividerHeight="@dimen/pad_5dp" 
    android:fastScrollEnabled="true" 
    android:paddingBottom="@dimen/pad_10dp" 
    android:paddingTop="@dimen/pad_10dp" 
    tools:listitem="@layout/chat_item_rcv" > 
</ListView> 
</RelativeLayout> 
<com.github.ksoichiro.android.observablescrollview.ObservableListView 
    android:id="@+id/list_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    /> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom|end" 
    android:layout_marginBottom="32dp" 
    android:layout_marginRight="32dp" 
    android:src="@drawable/ic_add_white_24dp" 
    app:borderWidth="0dp" 
    app:fabSize="normal" 
    app:rippleColor="@color/primary" 
    /> 

    <com.example.covite.chat_layout.BottomSheetLayout 
    android:id="@+id/bottom_sheet" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom" 
    app:ft_container_gravity="center" 
    app:ft_color="@color/primary"> 

    <ListView 
     android:id="@+id/list_menu" 
     android:background="@color/primary" 
     android:divider="@null" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 

</com.valuevision.covite.chat_layout.BottomSheetLayout> 
<LinearLayout 
    android:id="@+id/send_message_layout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_gravity="bottom" 
    android:background="#ffdddddd" 
    android:gravity="center_vertical" 
    android:orientation="horizontal"> 

    <ImageView 
     android:id="@+id/iv_image" 
     android:layout_width="40dp" 
     android:layout_height="40dp" 
     /> 

    <EditText 
     android:id="@+id/message" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" /> 

    <Button 
     android:id="@+id/sendMessageButton" 
     android:layout_width="48dp" 
     android:layout_height="48dp" 
     /> 

</LinearLayout> 

+0

Вы установили 'RelativeLayout' вместо' FrameLayout' –

+0

Почему вы используете фреймворк –

+0

спасибо за ответ @AnjaliTripathi, когда я меняю свой FrameLayout с RelativeLayout, но он не работает. –

ответ

1

Вы должны попробовать с

Я предполагаю FrameLayout создание этой проблемы.

  1. Использование RelativeLayout вместо FrameLayout

  2. Вызов ListView из стороны RelativeLayout

Надеется, что это помогает.

+0

спасибо за ответ @IntelliJ Я пробовал это, но он не работает –

+0

@ShubhankGupta Вы можете установить ListView 'android: layout_height =" match_parent "' –

+0

@ShubhankGupta Ji, вы можете попробовать с помощью 'LinearLayout' –

0

Изменение высоты макета, содержащий ваш ListView в fill_parent

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

и ваша высота ListView в match_parent

<ListView 
    android:layout_below="@+id/head" 
    android:id="@+id/list" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
.... 

Также убедитесь, что элементы списка вы поставляете в ListView достаточно долго для вас прокручивать. Надеюсь это поможет.

EDIT: Я не уверен, что такое BottomSheetLayout, но попробуйте установить его высоту макета также в match_parent.

<com.example.covite.chat_layout.BottomSheetLayout 
    android:id="@+id/bottom_sheet" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="bottom" 
    app:ft_container_gravity="center" 
    app:ft_color="@color/primary"> 

ИЛИ если возможно переместить ListView из BottomSheetLayout, и сделать его ребенка для RelativeLayout вместо этого.

+0

благодарит за ответ, но я пробовал, чтобы это не помогло мне –

+0

Попробуйте обновленный ответ. – Jiyeh

+0

Эй, брат, я пробую это, но он тоже не работает –

Смежные вопросы