小编Jay*_*Jay的帖子

为什么在滚动时自定义RecyclerView中的项目图像会发生变化?

我的应用程序工作正常,但我看到了一些项目改变图像滚动时,不知何故,我知道这是一个循环的问题,但我不知道如何解决它.我在我的适配器中尝试了一些代码修改,因为我认为它来自那里,但我没有成功.

 public void onBindViewHolder(CustomAdapter_VersionR.MyViewHolder holder, int position) {
    //get current product of the list
    currentProduit = productList.get(position);

    try {
        getImgUrl = currentProduit.getUrlImageList_thumb().get(0);  
        Picasso.with(context).load(getImgUrl).fit().into(myImageView);
        Log.i("INFO", "Image loaded");
    } catch (Exception e) {
        myImageView.setImageResource(R.drawable.no_image);
        Log.e("ERROR", "No image or image error");
        e.printStackTrace();
    }
Run Code Online (Sandbox Code Playgroud)

对于下载图像,我正在使用Picasso,感谢您的帮助!

编辑:完全适应

private Product currentProduit;
private ImageView myImageView;
private Context context;
private List<Product> productList;
private String getAgencyName, getImgUrl;
private List<String> getUrlList_Thumb;
private List<String> getUrlList_Full;
private ImageButton favorite_img_btn;
private boolean star_isClicked;


public CustomAdapter_VersionR(Context ctx, List<Product> products) {
    this.context = ctx;
    this.productList …
Run Code Online (Sandbox Code Playgroud)

android imageview android-studio picasso android-recyclerview

2
推荐指数
1
解决办法
1726
查看次数

如何使用矩阵比例尺中心imageView?

我正在使用Android Studio来显示imageView.我正在使用捏缩放来与我的ImageView进行交互.

码:

private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener{
    @Override
    public boolean onScale(ScaleGestureDetector detector) {
        scale = scale * detector.getScaleFactor();
        scale = Math.max(0.1f, Math.min(scale, 5f));
        matrix.setScale(scale, scale);

        imageView.setImageMatrix(matrix);
        return true;
    }
}

@Override
public boolean onTouchEvent(MotionEvent event) {
    scaleGestureDetector.onTouchEvent(event);
    return true;
}
Run Code Online (Sandbox Code Playgroud)

缩放很好,但问题是imageview的位置,它被卡在左上角.尝试布局更改但无关.经过一些研究,我已经在论坛ImageView Center中看到了这些链接与ScaleType矩阵的位置,在缩放捏合后将图像置于ImageView中,但这些解决方案无法正常工作,我还检查了内部给出的链接.

帮助将不胜感激,

谢谢 !

编辑:添加了关于我如何获得我的ImageView的代码

Picasso.with(this).load(url).resize(350, 330).centerInside().into(imageView);
Run Code Online (Sandbox Code Playgroud)

onCreate Code

的onCreate

ScaleListner类和手势代码

倾听者

android position image-zoom imageview scaletype

2
推荐指数
1
解决办法
5095
查看次数

根据另一个组合框值更改组合框值?

我对 C# 和 WPF 项目有点陌生。所以这是我的问题。

我有 2 个 Combobox 填充了字符串列表。

根据我的第一个组合框的值,我想更改第二个组合框中可用的列表。

这是我的代码:

public partial class MainWindow : Window
{
    //creation de listes
    List<string> themesE17 = new List<string>();
    List<string> themesH17 = new List<string>();
    List<string> themesE16 = new List<string>();
    List<string> themesH16 = new List<string>();



    public MainWindow()
    {
        InitializeComponent();

        initLists();

        string value = comboSaison.Text;
        Console.WriteLine("The value of season combobox " + value);

    }

    public void initLists()
    {
        //saison 2017
        themesE17.Add("Ete 17 Theme1");
        themesE17.Add("Ete 17 Theme2");

        themesH17.Add("Hiver 17 Theme1");
        themesH17.Add("Hiver 17 Theme2");

        //saison 2016 …
Run Code Online (Sandbox Code Playgroud)

c# data-binding wpf combobox

0
推荐指数
1
解决办法
966
查看次数