我想使用Picasso库在URL中设置ImageView
中的图像。 图像是从一些这样的链接加载:图像无法通过URL在ImageView中使用Picasso加载
https://pbs.twimg.com/profile_images/638751551457103872/KN-NzuRl.png
但从链接不加载这样的:
http://imagebin.ca/v/2J37dL9JufmN
我想不通的问题是什么。我想从第二个网址加载我的图片,但不起作用。
这里的* MainActivity.java **:
public class MainActivity extends AppCompatActivity {
ImageView a;
String Url;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
a = (ImageView) findViewById(R.id.a);
Url = "MY_URL";
Picasso.with(getApplicationContext())
.load(Url)
.placeholder(R.drawable.bday)
.into(a);
}
}
这里有一个片段从activity_main.xml中
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/a" />
</LinearLayout>
我已经在清单中设置所需的权限。我已经探索了几个类似于这个问题的链接,但无法解决这个问题。任何帮助表示赞赏。
我试过这个。此外,我已经在清单中提供了Internet访问权限。顺便说一句,谢谢,我自己想出了这个问题。问题在于使用URL。 – brainbreaker