Closed virovinrom closed 7 months ago
You have access to the accountHeader
from the AccountHeaderView
.
So if the layout includes an additional view, you can find it with the traditional findViewById
You have access to the
accountHeader
from theAccountHeaderView
.So if the layout includes an additional view, you can find it with the traditional
findViewById
You think like this
accountHeader.findViewById(R.id.sub_button)
but I have an error: Not enough information to infer type variable T
Please refer to the official docs on how to use platform APIs: https://developer.android.com/reference/android/view/View#findViewById(int)
findViewById
requires a type as the error states.
either it can infer the type, or you pass it findViewById<T>
where T
is your type.
Please refer to the official docs on how to use platform APIs: https://developer.android.com/reference/android/view/View#findViewById(int)
findViewById
requires a type as the error states.either it can infer the type, or you pass it
findViewById<T>
whereT
is your type.
Am I correct?
accountHeader.findViewById<AppCompatButton>(R.id.sub_button)
I don't know the type of your button, but yes, something like that :D
I don't know the type of your button, but yes, something like that :D
much obliged
You are welcome.
Can I somehow override AccountHeaderView? I have my own material_drawer_header file with additional button.
I used kotlinx synthetic to refer to this button
headerView = AccountHeaderView(ctx).apply { sub_button.visibility = View.VISIBLE }
but now I need to migrate to viewbinding and sub_button are now unresolved. How can I manage this issue?