ピカソを使用しているimageViewにURL(有効)からイメージをロードしようとしています。私はGradleの経由ピカソlibaryを追加したと私は両方を追加しました:Picasso Not Loading Image from url
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
私のコードに、他の多くのユーザーが指摘しています。 私は間違いがなく、10秒以上経っても何もしません。
ImageView image;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
image=(ImageView)findViewById(R.id.image);
Picasso.with(getApplicationContext()).load("http://i.imgur.com/DvpvklR.png").into(image);
}
と私の活動のXML::
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.benhouse.testproj.MainActivity">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="0dp"
tools:layout_editor_absoluteY="8dp"
tools:layout_editor_absoluteX="8dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:id="@+id/image"/>
</RelativeLayout>
それが動作するように取得する方法上の任意のアイデアここで は私のJavaメソッドのですか? 私は確かに私がどこかで間違いを犯していると確信しています。私はここで2つのことをしようとすることをお勧め
グライドライブラリを試してみてください...いくつかの時間が私はピカソを使用して、このような問題に直面しているが、それはglide.httpsで解決://github.com/bumptech/glide –
は親切デバイスまたはAPIを述べましたレベル – sivaprakash
XMLをチェックしてください。間違いはXMLファイルにあると思います。なぜあなたは相対レイアウトを使用するよりも制約レイアウトを使用していますか? –