A
A
Akim Glushkov2017-08-25 10:27:56
JavaScript
Akim Glushkov, 2017-08-25 10:27:56

Elements inside RelativeView are not clickable API >=24 but 17-23 is ok. Why?

I have a view with the following structure:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clickable="true"
    android:focusable="true"
    android:focusableInTouchMode="true">
<!-- ....  -->
<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/layout_title"
        android:layout_marginTop="20dp"
        android:orientation="vertical"
        android:paddingBottom="8dp"
        android:paddingLeft="16dp"
        android:paddingRight="16dp"
        android:weightSum="4">
<!-- И четыре таких RelativeLayout -->
<RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:clickable="true"
            android:clipChildren="false"
            android:clipToPadding="false"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:padding="8dp">

<!-- .... -->

Elements inside the parent RelativeVIew do not respond to clicks in the emulator.
On Android 4.*, 5 and 6 everything is fine.
Comrades, what could be the problem?
There is a suspicion of this insert, but I don’t remember what it is for and what breaks with it.
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.0.0'
            }
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DENIS Kokorev, 2017-08-28
@mikaakim

Try to put this thing in the top RelativeLayout
android:descendantFocusability="blocksDescendants"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question