android-include

Databinding variable inheritance with included layout

痞子三分冷 提交于 2019-12-08 16:21:06
问题 I am learning data binding and mvvm. I have an issue where I would like a BaseViewModel.kt to include some UI related variables such as an isLoading flag and loadingText . When a network request is made, I set isLoading to true and some child of my base view model should set the text. For example for a LoginViewModel.kt the text might be 'logging in'. Is it possible to pass these variables to an included base layout? So a login_activity.xml might include this in it's layout: <data> <import

Android: <include> with RippleEffect & StateListAnimator

放肆的年华 提交于 2019-12-05 12:31:03
问题 I have a layout, that includes another layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/layout1"> <include layout="@layout/my_layout"/> </LinearLayout> I need to add a RippleEffect as well as a StateListAnimator to the included layout. Example: <include layout="@layout/my_layout" android:stateListAnimator="@anim/lift_up" android:background="

Android: <include> with RippleEffect & StateListAnimator

自古美人都是妖i 提交于 2019-12-03 23:35:31
I have a layout, that includes another layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/layout1"> <include layout="@layout/my_layout"/> </LinearLayout> I need to add a RippleEffect as well as a StateListAnimator to the included layout. Example: <include layout="@layout/my_layout" android:stateListAnimator="@anim/lift_up" android:background="@drawable/ripple_effect"/> Both the RippleEffect and StateListAnimator work 100%. I cannot alter the