• 安卓开发


    src标签:
    public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView t1 = (TextView) findViewById(R.id.txtOne); String s1 = "图片:<img src = 'icon'/><br>"; t1.setText(Html.fromHtml(s1, new Html.ImageGetter() { @Override public Drawable getDrawable(String source) { Drawable draw = null; try { Field field = R.drawable.class.getField(source); int resourceId = Integer.parseInt(field.get(null).toString()); draw = getResources().getDrawable(resourceId); draw.setBounds(0, 0, draw.getIntrinsicWidth(), draw.getIntrinsicHeight()); } catch (Exception e) { e.printStackTrace(); } return draw; } }, null)); } }
  • 相关阅读:
    HTML中Css补充资料
    HTML表单
    HTML盒子模型
    标准文档流
    什么使用面向对象
    static修饰
    static修饰
    列表样式
    java基础(9)
    java基础(8)
  • 原文地址:https://www.cnblogs.com/20193898liufa/p/14906308.html
Copyright © 2020-2023  润新知