【问题标题】:how to set imageview as url by using extra如何使用 extra 将 imageview 设置为 url
【发布时间】:2016-07-28 00:27:05
【问题描述】:

我正在尝试使用自定义图像视图更改滚动视图的图像,但我不知道如何设置图像视图以显示 url

public class NewsDetails extends AppCompatActivity {
CoordinatorLayout coordinatorLayout;
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_news_details);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    coordinatorLayout= (CoordinatorLayout) findViewById(R.id.newsscroll);
    Bundle extra = getIntent().getExtras();
    TextView tv = (TextView)findViewById(R.id.contenttext);
    tv.setText(extra.getString("Message"));
    ImageView im = (ImageView) findViewById(R.id.thumb_img2);
    im.set
}

`

【问题讨论】:

    标签: android url android-studio imageview extra


    【解决方案1】:

    我不能完全理解您的问题,但如果您尝试将图像从 URL 加载到 ImageView 中,您有多种选择:

    • 使用库为您完成。其中一些是:PicassoUILFresco 等...
    • 使用网络库从 Internet 下载图像,然后将其设置为 ImageView 作为位图(这基本上是在重新发明轮子,因为前面提到的库非常好且可靠。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-29
      • 2014-03-27
      • 2016-08-06
      相关资源
      最近更新 更多