使用Glide时无法解析为()方法

时间:2017-12-31 18:21:13

标签: android android-glide

我使用以下代码,但它说它无法解析为()方法。我能做些什么呢?

compile 'com.android.support:design:+'
compile 'com.github.karanchuri:PermissionManager:0.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'

compile 'com.android.support:cardview-v7:26.0.2'
compile 'com.android.support:recyclerview-v7:26.0.2'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.bumptech.glide:glide:4.0.0-RC0'
compile 'com.android.support:support-v4:26.3.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'

这是我的gradle文件依赖项:

依赖项{

    package com.example.android.monopolycredit;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;

public class LoginLobby extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login_lobby);

        final EditText usernameEditText = findViewById(R.id.usernameField);
        usernameEditText.setOnEditorActionListener(
                new EditText.OnEditorActionListener() {
                    @Override
                    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                        if (actionId == EditorInfo.IME_ACTION_SEARCH ||
                                actionId == EditorInfo.IME_ACTION_DONE ||
                                event.getAction() == KeyEvent.ACTION_DOWN &&
                                        event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
                            if (!event.isShiftPressed()) {
                                // the user is done typing.
                                usernameEditText.setVisibility(View.GONE);
                                return true; // consume.
                            }
                        }
                        return false; // pass on to other listeners.
                    }
                });
    }

}

1 个答案:

答案 0 :(得分:0)

你有几个问题:

  1. 您对Glide有多个依赖关系。只保留一个并删除其余部分。您可以找到最新的here

  2. 您的问题很简单,get_ImageLink()后遗漏括号。将其更改为此应该有效:

  3. Glide.with(context).load(info.get(position).getImage_link()).into(holder.imageView));