android 渲染组件 在Java类写法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/aduovip/article/details/7020360

  LayoutInflater inflater = LayoutInflater.from(context);

 SeekBar seekbar =  (SeekBar)inflater.inflate(R.layout.seekbar, null);

注意:使用填充布局时,两种写法
 1.  LayoutInflater.from(Context context).inflate(int resource, ViewGroup root);
 2.  activity.getLayoutInflater().inflate(int resource, ViewGroup root);

猜你喜欢

转载自blog.csdn.net/aduovip/article/details/7020360