Closed 1411862854 closed 6 months ago
fragment页面xml: `<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="?attr/xui_config_color_background" android:orientation="vertical">
<com.xuexiang.xui.widget.actionbar.TitleBar android:id="@+id/titlebar" android:layout_width="match_parent" android:layout_height="wrap_content" app:tb_actionPadding="20dp" app:tb_centerGravity="center" app:tb_titleText="这是一个Title" app:tb_useThemeColor="false" android:background="@color/app_color_theme_7" />
` fragment页面class: import com.xuexiang.xaop.annotation.SingleClick; import com.xuexiang.xpage.annotation.Page; import com.xuexiang.xpage.enums.CoreAnim; import com.xuexiang.xui.utils.DensityUtils; import com.xuexiang.xui.widget.actionbar.TitleBar; import butterknife.BindView; /**
@since 2019-10-30 00:19 */ @Page(anim = CoreAnim.none) public class NfcFragment extends BaseFragment {
@BindView(R.id.titlebar) TitleBar mTitleBar;
@NonNull @Override protected FragmentNfcBinding viewBindingInflate(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, boolean attachToRoot) { return FragmentNfcBinding.inflate(inflater, container, attachToRoot); }
@Override protected int getLayoutId() { return R.layout.fragment_nfc; }
/**
这是因为你使用的是模板工程, 默认使用的是viewBinding,而非butterknife, 你使用@BindView(R.id.titlebar)是无法获取的组件的,自然initViews里的方法也无法生效
fragment页面xml: `<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="?attr/xui_config_color_background" android:orientation="vertical">
` fragment页面class: import com.xuexiang.xaop.annotation.SingleClick; import com.xuexiang.xpage.annotation.Page; import com.xuexiang.xpage.enums.CoreAnim; import com.xuexiang.xui.utils.DensityUtils; import com.xuexiang.xui.widget.actionbar.TitleBar; import butterknife.BindView; /**
@since 2019-10-30 00:19 */ @Page(anim = CoreAnim.none) public class NfcFragment extends BaseFragment {
@BindView(R.id.titlebar) TitleBar mTitleBar;
@NonNull @Override protected FragmentNfcBinding viewBindingInflate(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, boolean attachToRoot) { return FragmentNfcBinding.inflate(inflater, container, attachToRoot); }
@Override protected int getLayoutId() { return R.layout.fragment_nfc; }
/**
/**