Есть ли возможность обрабатывать нажатие кнопки внутри включенного xml (без фрагмента):
применить плагин: 'kotlin-android-extensions'
activity.kt
leftBarButton.setOnClickListener {
Log.d(TAG,"unaccessible!")
}
activity.xml
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:fitsSystemWindows="true">
<include layout="@layout/navbar"
android:id="@+id/navBar"/>
</LinearLayout>
navbar.xml
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark"
android:fitsSystemWindows="true"
android:layout_marginBottom="5pt"
android:gravity="bottom">
<Button
android:id="@+id/leftBarButton"
android:layout_width="37dp"
android:layout_height="30dp"
android:layout_marginStart="@dimen/borderrmargin"
android:background="@drawable/ic_home"
android:layout_weight="0.1"/>
<TextView
android:id="@+id/titleApp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorTitleText"
android:textAlignment="center"
android:text="@string/title"
android:textSize="20sp"
android:layout_weight="0.8"/>
<Button
android:id="@+id/rightBarButton"
android:layout_width="37dp"
android:layout_height="30dp"
android:layout_marginEnd="@dimen/borderrmargin"
android:background="@drawable/ic_home"
android:layout_weight="0.1"/>
</LinearLayout>
</RelativeLayout>
</merge>
onClickListener не работает