单击时如何使图库中的ImageView更大

时间:2017-04-20 17:46:14

标签: java android android-imageview

我的应用中有一个图库,有一个GridLayout我希望当用户点击它时,它会弹出 this 效果,¿我怎样才能实现那? 如果有人能告诉我它是如何被调用的效果或图书馆或者其他什么我怎么能这样做我会非常感激,到目前为止我已经尝试过这个没有运气的图书馆https://github.com/mzelzoghbi/ZGallery?utm_source=android-arsenal.com&utm_medium=referral&utm_campaign=4987

如果有人能看到错误,这是我的代码:

public class BusinessPremiumGallery extends AppCompatActivity implements GridClickListener
{
GalleryAdapter galleryAdapter;
    Gson gson;
    private static final Type BUSINESS_TYPE = new TypeToken<ArrayList<Business>>() {}.getType();

    JsonObject images;
    GridLayoutManager layoutManager;
    ArrayList<Business> arrayGallery;
    ArrayList<String> arrayImages;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_business_premium_gallery);
        Bundle bundle = getIntent().getExtras();
        final int values = bundle.getInt("no");
        new PlifRequestBase(BusinessPremiumGallery.this) {

            @Override
            public JsonObject onHttpOk(JsonObject response) throws JSONException {
                JsonObject respuesta, details, location, geolocation, matrix, schedules_array;
                JsonArray data,branches, phones, schedules,extra_services,user_images;
                respuesta = response;
                int catalog_id;
                String catalog_descrip,catalog_name,catalog_image,image;

                Log.d("VALUES2",String.valueOf(values));
                arrayGallery=new ArrayList<Business>();
                gson=new Gson();
                user_images= respuesta.get("user_images").getAsJsonArray();


                if(user_images.size()<0){
                    arrayGallery=null;
                    images=null;

                }else {
                    arrayGallery=gson.fromJson(user_images,BUSINESS_TYPE);
                    for (int i = 0; i < user_images.size(); i++) {
                        images = user_images.get(i).getAsJsonObject();
                        image=images.get("image").getAsString();
                       Log.d("IMAGES",image);
                        Log.d("CATALOG",String.valueOf(images));

                    }


                }
                if (BusinessPremiumGallery.this == null)
                    return response;
                BusinessPremiumGallery.this.runOnUiThread(new Runnable() {
                    public void run() {
                        RecyclerView recycler = (RecyclerView) BusinessPremiumGallery.this.findViewById(R.id.recycler_gallery);
                        galleryAdapter = new GalleryAdapter(BusinessPremiumGallery.this, arrayGallery, R.layout.row_gallery_premium);
                        recycler.setNestedScrollingEnabled(false);
                        layoutManager = new GridLayoutManager(BusinessPremiumGallery.this, 2);
                        recycler.setLayoutManager(layoutManager);
                        recycler.setAdapter(galleryAdapter);
                    }

                });

                return respuesta;
            }

            @Override
            public void onHttpCreate(JsonObject response) throws JSONException
            {

            }
        }.execute("businesses/"+String.valueOf(values), "GET");
    }


    @Override
    public void onBackPressed()
    {

        super.onBackPressed();  // optional depending on your needs
    }

    @Override
    public void onClick(int i) {
        ZGallery.with(this, arrayImages)


                .show();
    }
}

0 个答案:

没有答案