메뉴 건너뛰기

?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

안드로이드 상에서 URL 웹주소로 되어 있는 이미지를 그대로 불러오고 싶을때, 몇가지 라이브러리 파일이 있는데,

필자는 Glide 를 사용해 보았다.

정말 사용법이 간단하다.

 

https://github.com/bumptech/glide

http://bumptech.github.io/glide/doc/download-setup.html#jar

 

 

1. build.gradel (app) 에서 아래 jar 를 추가한다.

    dependencies {
     implementation 'com.github.bumptech.glide:glide:4.9.0'
     annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
    }

버전 숫자는 최신버전, 구버전다 상관없이 잘 돌아간다.

 

2. AndroidManifest.xml 파일내 웹접근이 가능하도록 퍼미션 추가한다.

<uses-permission android:name="android.permission.INTERNET"/>

3. xml 디자인 소스에 ImageView 를 올려 놓는다. 

보통의 경우 activity_main.xml 을 기준으로 올려 본다.

1
2
3
4
5
6
7
8
9
10
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
 
       <ImageView
            android:id="@+id/imageView1"
            android:layout_width="80dp"
            android:layout_height="80dp"/>
 
</LinearLayout>
cs

 

4. java 파일에서 직접 사용해 본다. (MainActivity.java)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public class MainActivity extends AppCompatActivity {
 
    private ImageView imageView1;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        imageView1 = findViewById(R.id.imageView1);
 
 
        String imageStr = "http://도메인주소/image/abc.png";
        Glide.with(this).load(imageStr).into(imageView1);
 
    }
}
 
cs

 


List of Articles
번호 제목 날짜 조회 수
217 안드로이드 - 커스텀 폰트(Custom Font) 적용하기 file 2021.04.02 344
216 Volley 로 웹요청하고 응답받기1 - Get방식 file 2020.12.14 348
215 Volley 이용시에 한글 깨질때 UTF-8로 변경 2020.12.14 348
214 안드로이드 - 인텐트(Intent)를 활용한 액티비티(Activity)간 데이터 전달하기 file 2021.03.31 349
213 Fragment에서 Toast 사용하기 2020.12.14 376
212 Volley 로 웹요청하고 응답받기3 - Get방식 , json 읽기 (php,mysql) file 2020.12.14 378
211 안드로이드 - 리사이클러 뷰(RecyclerView) 구현 file 2021.04.01 390
210 안드로이드 - SharedPreferences에 앱 정보 저장하기 file 2021.04.02 395
209 안드로이드 스튜디오 - 코드 자동 들여쓰기 file 2021.03.29 420
208 안드로이드 - 프로그레스바(ProgressBar) 구현하기 file 2021.04.01 451
207 안드로이드 - 툴바(ToolBar)를 사용하여 앱바(App Bar) 구현하기 file 2021.04.01 455
206 안드로이드 입문 연습문제 3문항 - CheckBox, RadioButton, EditText, Spinner, 이벤트연습 file 2020.12.14 480
205 구글맵 snippet을 두줄이상으로 구현하기 file 2020.12.14 481
204 안드로이드 - 액티비티(Activity)로부터 결과 데이터 받아오기 file 2021.03.31 483
203 안드로이드 - 프래그먼트 (Fragment) 사용하기 file 2021.04.02 486
202 안드로이드 - 리스트뷰(ListView) 구현 file 2021.04.01 490
201 안드로이드 - RecyclerView 안에 RecyclerView 구현하기 file 2021.04.02 502
200 안드로이드 - 프레임레이아웃 (FrameLayout) file 2021.03.29 517
199 안드로이드 - 색상 리소스 (Color Resource) 추가 </color> file 2021.03.31 551
198 안드로이드 - Text 입력 이벤트 처리 - TextWatcher file 2021.04.02 557
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 13 Next
/ 13

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved