how to get id in different layout

后端 未结 5 1971
無奈伤痛
無奈伤痛 2020-12-30 14:52

i have id \"@+id/call\" in single_item.xml when i use findVewById it (the layout setcontextview(R.layout.main)) .the ap

5条回答
  •  余生分开走
    2020-12-30 15:42

    If you want to get the id in the fragment use the following method. replace the return statement with view like this.

     View view= inflater.inflate(R.layout.fragment_left, container, false);
     img=view.findViewById(R.id.image);
     return view;
    

    call all the methods before you return the view.

提交回复
热议问题