How do I Inflate a Custom View in XML?

后端 未结 1 1705
有刺的猬
有刺的猬 2021-01-18 19:18

This is my first time trying to use a custom view in XML and I am not sure on how to do it. Any help would be greatly appreciated.

I am using Interfuser\'s coverflow

相关标签:
1条回答
  • 2021-01-18 20:13
    LayoutInflater inflater = (LayoutInflater) this
     .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View v = inflater.inflate(R.layout."layout here", null, false);
    

    and to use,eg

     TextView tv=(TextView)v.findViewById(R,id."id here");
    
    0 讨论(0)
提交回复
热议问题