0

As the title says, I have a fragment with two list views and i want to add a border at the end of the second list view. I know that this is usally achieved in the xml writing:

android:paddingBottom="50dp"
android:clipToPadding="false"

And when i use only one listView it works perfectly but not with two i don't know why. I have tried adding a white layout in the getView of my baseAdapter but the problem is that I want to manage long clicks i for that I use :

listViewSin.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL);
listViewSin.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {...});

And in this method I can't know the kind of view that is clicked before the menu is created, so i don't want to add a new view.

The layout code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="10dip" >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:text="@string/sin"
            android:textColor="@color/black"
            android:textSize="15sp"
            android:id="@+id/android"/>

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#000000"
            />


        <ListView
            android:id="@+id/listView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dip"
            android:divider="@null"
            android:dividerHeight="0dp"
            android:background="#FFFFFF"/>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dip"
            android:gravity="center_vertical"
            android:text="@string/hechos"
            android:textColor="#A2A2A2"
            android:id="@+id/ios"/>
        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#A2A2A2"
            />

        <ListView
            android:id="@+id/listView2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dip"
            android:background="#A2A2A2"
            android:divider="@null"
            android:dividerHeight="0dp"
            android:paddingBottom="80dp"
            android:clipToPadding="false"
            />

    </LinearLayout>

</ScrollView>
<android.support.design.widget.FloatingActionButton
    android:id="@+id/tareas_add"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:src="@drawable/add"
    android:layout_marginRight="10dp"
    android:layout_marginBottom="10dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:layout_marginEnd="10dp" />

Thirsty
  • 188
  • 2
  • 12

1 Answers1

0

Define a shape drawable in a way similar to what's explained here:

Android border bottom for custom view not working

Set the rectangle's color to your ListView's background color, and the stroke's color to your desired bottom border color. Then in xml, in your ListView element background attribute, reference the shape with @drawable/...

Community
  • 1
  • 1
speirs23
  • 127
  • 9