Advertisement

Android开发:动态增加WebView元素展示进度条和标题栏

阅读量:

传统方式:观察图像

简而言之,即无需借助layout的xml文件来定义界面布局,而是通过纯代码的方式手动编写布局逻辑,以实现上述效果:具体代码如下:

将以下代码放置于onCreate方法中,即可实现布局的动态加载

复制代码
  LinearLayout linearLayout = new LinearLayout(this);

    
     linearLayout.setOrientation(LinearLayout.VERTICAL);
    
     tvWebViewTitle = new TextView(this);
    
 //        tvWebViewTitle.setCompoundDrawables(ContextCompat.getDrawable(this, R.drawable.ic_arrow_back_black_24dp), null, 

全部评论 (0)

还没有任何评论哟~