Closed KunMinX closed 4 years ago
for the first issue, you can reproduct it by this project: https://issuetracker.google.com/action/issues/143677219/attachments/27847098?download=true
for the second issue, the @{click}
is like below:
public class ClickProxy implements TabLayout.OnTabSelectedListener{
public void onLeftClick() {
FragmentNavigator.getInstance().navigateUp();
}
@Override
public void onTabSelected(TabLayout.Tab tab) {
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
}
...
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_wish, container, false);
mBinding = FragmentWishBinding.bind(view);
mBinding.setClick(mClickProxy = new ClickProxy());
return view;
}
...
<data>
<variable
name="click"
type="com.kunminx.fairytale.ui.page.about.WishFragment.ClickProxy" />
</data>
...
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
---> app:onTabSelectedListener="@{click}"
app:tabBackground="@drawable/tab_item_selector"
app:tabIndicatorHeight="0dp"
app:tabRippleColor="@color/white"
app:tabSelectedTextColor="@color/dark"
app:tabTextAppearance="@style/TabLayoutTabTextStyle"
app:tabTextColor="@color/dark">
Environment: AndroidX, Android Studio 3.5.3, gradle plugin 3.5.3, gradle version 5.4.1
SeekBar.OnSeekBarChangeListener
can bindapp:onSeekBarChangeListener="@{click}"
in layout well,whileTabLayout.OnTabSelectedListener
can not.app:onTabSelectedListener="@{click}"
can not bind well.