xuexiangjys / XUI

💍A simple and elegant Android native UI framework, free your hands! (一个简洁而优雅的Android原生UI框架,解放你的双手!)
https://xuexiangjys.github.io/XUI/
Apache License 2.0
4.85k stars 835 forks source link

标题栏使用无效的问题 #174

Closed 1411862854 closed 6 months ago

1411862854 commented 10 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; /**

xuexiangjys commented 6 months ago

这是因为你使用的是模板工程, 默认使用的是viewBinding,而非butterknife, 你使用@BindView(R.id.titlebar)是无法获取的组件的,自然initViews里的方法也无法生效