Tuesday, 22 January 2019

textIsSelectable is not working with descendantFocusability=blocksDescendants

I had an issue that my ScrollView in fragment auto-scroll to bottom. So to fix this issue I have added following line in RelativeLayout as suggested in this answer:

android:descendantFocusability="blocksDescendants"

But after adding this line, textIsSelectable is stopped working for. How can I add both lines?

Here is the XML:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:descendantFocusability="blocksDescendants">

    <TextView
        android:id="@+id/title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="15dp"
        android:textSize="23sp"
        android:text="The Beach Beneath the Street"
        android:fontFamily="sans-serif-medium"
        android:textColor="@color/black"
        android:textIsSelectable="true"/>

    <TextView
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/title"
        android:padding="15dp"
        android:fontFamily="sans-serif-condensed"
        android:lineHeight="25dp"
        android:lineSpacingMultiplier="1"
        android:lineSpacingExtra="6dp"
        android:textSize="16sp"
        android:text="Never add a RecyclerView or ListView to a scroll view"
        android:textIsSelectable="true" />

</RelativeLayout>



from textIsSelectable is not working with descendantFocusability=blocksDescendants

No comments:

Post a Comment