我想从活动中调用视图,并且我有一个具有充气功能的类。但我不能使用它
说找不到课 Resources $ NotFoundException:资源ID#0x0
MainActivity
override fun onCreate(savedInstanceState: Bundle?) {
requestWindowFeature(Window.FEATURE_NO_TITLE)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
menu_button.setOnClickListener {
v:View-> val view_menu = View_menu(this, "root_layout")
if(view_menu != null) view_menu.removeFromContainer()
view_menu.initInterface()
view_menu.addContentToContainer()
View_menu
open class View_menu : _View, View.OnClickListener {
init{
mContent.close_button.setOnClickListener (this)
mContent.question_button.setOnClickListener (this)
mContent.cooper_button.setOnClickListener (this)
mContent.privacy_button.setOnClickListener (this)
}
constructor(activity: Activity, containerName: String) : super(activity, containerName, "view_menu")
这是_View类
open class View_menu : _View, View.OnClickListener {
init{
mContent.close_button.setOnClickListener (this)
mContent.question_button.setOnClickListener (this)
mContent.cooper_button.setOnClickListener (this)
mContent.privacy_button.setOnClickListener (this)
}
constructor(activity: Activity, containerName: String) : super(activity, containerName, "view_menu")
我从那里得到了错误
constructor(activity: Activity, containerName: String) : super(activity, containerName, "view_menu")
我要从“活动”切换到“查看”