2016-12-30 3 views
0

高解像度を持つため、描画可能なイメージをロードするためにピカソを使用しました。すべての描画可能なイメージがピカソを使用してロードされているわけではありません

問題は次のとおりです:すべての画像が読み込まれているわけではありません。時には3画像に4画像が表示されます。ここで

はコードです:ここでは

import android.content.Context; 
import android.os.Bundle; 
import android.support.v7.app.AppCompatActivity; 
import android.widget.ImageView; 

import com.squareup.picasso.MemoryPolicy; 
import com.squareup.picasso.Picasso; 




public class SummaryOfTour extends AppCompatActivity { 
    Context context; 

    ImageView imageView ,imageView1,imageView2,imageView3,imageView4,imageView5; 


    static int ms1,ms2,ms3,ms4,ms5; 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_summary_of_tour); 

     imageView = (ImageView) findViewById(R.id.img1); 
     imageView1 = (ImageView) findViewById(R.id.img2); 
     imageView2 = (ImageView) findViewById(R.id.img3); 
     imageView3 = (ImageView) findViewById(R.id.img4); 
     imageView4 = (ImageView) findViewById(R.id.img5); 

if(ms1 ==1) { 

    Picasso.with(this) 
      .load(R.drawable.mp1) 
      .resize(1000, 1690) 

      .into(imageView); 


    Picasso.with(this) 
      .load(R.drawable.mp2) 
      .resize(1000, 1690) 
      .into(imageView1); 

    Picasso.with(this) 
      .load(R.drawable.mp3) 
      .resize(1000, 1690) 
      .into(imageView2); 

    Picasso.with(this) 
      .load(R.drawable.mp4) 
      .resize(1000, 1690) 
      .into(imageView3); 

    Picasso.with(this) 
      .load(R.drawable.bg) 
      .resize(1000, 1700) 
      .into(imageView4); 

} 
     else if (ms2 ==1) { 
      Picasso.with(this) 
        .load(R.drawable.mp11) 
        .resize(1000, 1690) 
        .into(imageView); 

      Picasso.with(this) 
        .load(R.drawable.mp22) 
        .resize(1000, 1690) 
        .into(imageView1); 

      Picasso.with(this) 
        .load(R.drawable.mp33) 
        .resize(1000, 1690) 
        .into(imageView2); 

      Picasso.with(this) 
        .load(R.drawable.mp44) 
        .resize(1000, 1690) 
        .into(imageView3); 

      Picasso.with(this) 
        .load(R.drawable.bg) 
        .resize(1000, 1700) 
        .into(imageView4); 

     } 

else if (ms3 ==1) { 
    Picasso.with(this) 
      .load(R.drawable.mp111) 
      .resize(1000, 1690) 
      .into(imageView); 

    Picasso.with(this) 
      .load(R.drawable.mp222) 
      .resize(1000, 1690) 
      .into(imageView1); 

    Picasso.with(this) 
      .load(R.drawable.mp333) 
      .resize(1000, 1690) 
      .into(imageView2); 

    Picasso.with(this) 
      .load(R.drawable.mp444) 
      .resize(1000, 1690) 
      .into(imageView3); 

    Picasso.with(this) 
      .load(R.drawable.bg) 
      .resize(1000, 1700) 
      .into(imageView4); 

} 

else if (ms4 ==1) { 
    Picasso.with(this) 
      .load(R.drawable.mp1111) 
      .resize(1000, 1690) 
      .into(imageView); 

    Picasso.with(this) 
      .load(R.drawable.mp2222) 
      .resize(1000, 1690) 
      .into(imageView1); 

    Picasso.with(this) 
      .load(R.drawable.mp5555) 
      .resize(1000, 1690) 
      .into(imageView2); 

    Picasso.with(this) 
      .load(R.drawable.mp7777) 
      .resize(1000, 1690) 
      .into(imageView3); 

    Picasso.with(this) 
      .load(R.drawable.mp66666) 
      .resize(1000, 1700) 
      .into(imageView4); 

} 





    } 
} 

は私のXMLです:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="com.sumo.traffic.InfoOfArtInIsland" 
    android:background="#87E886" 
    android:orientation="vertical"> 
    <ScrollView 
     android:id="@+id/scrollView1" 
     android:layout_width="match_parent" 
     android:layout_height="500dp" > 
     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" 
      android:weightSum="1"> 



      <LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal" 
       android:layout_marginTop="10dp"> 
       <ImageView 
        android:layout_width="100dp" 
        android:layout_height="100dp" 
        android:id="@+id/imageView5" 
        android:src="@drawable/loaders" 
        android:layout_alignParentTop="true" 
        android:layout_centerHorizontal="true" 
        android:layout_marginLeft="100dp" 
        android:layout_gravity="right" /> 
      </LinearLayout> 



      <RelativeLayout 
       android:layout_width="320dp" 
       android:layout_height="550dp" 
       android:orientation="horizontal" 
       android:layout_marginTop="10dp" 
       android:background="#BEFFB6" 
       android:layout_marginLeft="10dp"> 



       <ImageView 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:id="@+id/img1" 

        android:layout_alignParentTop="true" 
        android:layout_alignStart="@+id/bckgrndViewFlipper1" /> 
      </RelativeLayout> 
      <RelativeLayout 
       android:layout_width="320dp" 
       android:layout_height="550dp" 
       android:orientation="horizontal" 
       android:layout_marginTop="10dp" 
       android:background="#BEFFB6" 
       android:layout_marginLeft="10dp"> 



       <ImageView 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:id="@+id/img2" 

        android:layout_alignParentTop="true" 
        android:layout_alignStart="@+id/bckgrndViewFlipper1" /> 
      </RelativeLayout> 

      <RelativeLayout 
       android:layout_width="320dp" 
       android:layout_height="550dp" 
       android:orientation="horizontal" 
       android:layout_marginTop="10dp" 
       android:background="#BEFFB6" 
       android:layout_marginLeft="10dp"> 



       <ImageView 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:id="@+id/img3" 

        android:layout_alignParentTop="true" 
        android:layout_alignStart="@+id/bckgrndViewFlipper1" /> 
      </RelativeLayout> 


      <RelativeLayout 
       android:layout_width="320dp" 
       android:layout_height="550dp" 
       android:orientation="horizontal" 
       android:layout_marginTop="10dp" 
       android:background="#BEFFB6" 
       android:layout_marginLeft="10dp"> 



       <ImageView 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:id="@+id/img4" 

        android:layout_alignParentTop="true" 
        android:layout_alignStart="@+id/bckgrndViewFlipper1" /> 
      </RelativeLayout> 


      <RelativeLayout 
       android:layout_width="320dp" 
       android:layout_height="550dp" 
       android:orientation="horizontal" 
       android:layout_marginTop="10dp" 
       android:background="#BEFFB6" 
       android:layout_marginLeft="10dp"> 



       <ImageView 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:id="@+id/img5" 

        android:layout_alignParentTop="true" 
        android:layout_alignStart="@+id/bckgrndViewFlipper1" /> 
      </RelativeLayout> 







      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

      <!-- to be commented xml block goes here --> 

     </LinearLayout> 






     <!-- to be commented xml block goes here --> 

     <!-- to be commented xml block goes here --> 

     <!-- to be commented xml block goes here --> 

     <!-- to be commented xml block goes here --> 

     <!-- to be commented xml block goes here --> 




     <!--  <LinearLayout 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:orientation="horizontal" 
        android:layout_marginTop="20dp"> 
        <ImageButton 
         android:layout_width="wrap_content" 
         android:layout_height="100dp" 
         android:id="@+id/imageButton3" 
         android:background="@drawable/faqz" 
         android:layout_alignParentBottom="true" 
         android:layout_alignParentStart="true" 
         android:layout_marginBottom="10dp"/> 

       </LinearLayout> 

    --> 




    </ScrollView> 
</LinearLayout> 
+0

グライドに切り替えると写真が表示され、すべてがスムーズになりました。私はむしろピカソではなくグライドを勧めたい。私の意見では。 – AndroidProgrammerThatWantsMe

答えて

0

は、XMLファイル内のあなたのイメージソースを定義します.... アンドロイド:SRC = "@ drawablw/yourimgnameを"

画像の拡張子は" .png "でなければなりません 画像名はIntegerで始めることはできません。

0
Picasso.with(this) 
      .placeholder(R.drawable.mp1) 
      .resize(1000, 1690) 
      .into(imageView); 

を使用します。プレースホルダinstend負荷。

関連する問題