메뉴 건너뛰기

?

단축키

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
번호 제목 날짜 조회 수
57 JSON(JavaScript Object Notation) - jQuery Ajax - jQuery.getJSON() 메서드 (비동기적으로 JSON파일 로드) file 2014.10.16 6568
56 jQuery ajax post 요청 text 응답 2014.10.16 6702
55 jQuery Ajax - jQuery.load() 메서드 (동적으로 원격 페이지 로드) file 2014.10.16 6422
54 Java에서 XML 불러와서 동적 변화 주기 file 2021.03.31 288
53 JavaScript 맛보기 file 2014.09.04 6589
52 JAVA JDBC를 사용하여 MySQL과 연동 file 2015.11.21 8646
51 Java Applet과 javascript와의 통신 2015.06.29 7759
50 Invalid project description 문제 file 2015.07.01 7123
49 Intent (인텐트) 2016.06.07 7626
48 ImageVeiw의 현재 리소스 비교하기 2014.08.28 6752
47 HTML5로 비디오 보여주기 Video Tag file 2014.09.04 7062
46 HTML5로 나만의 비디오 플레이어 스킨 만들기 -3- JavaScript file 2014.09.04 6288
45 HTML5로 나만의 비디오 플레이어 스킨 만들기 -2- JavaScript file 2014.09.04 6312
44 HTML5로 나만의 비디오 플레이어 스킨 만들기 -1- CSS file 2014.09.04 6453
43 HTML5로 게임 만들기 워밍업 file 2014.09.04 6063
42 HTML5 시작하기 file 2014.09.04 5660
41 HTML5 드래그 앤 드롭 하기 Drag and Drop file 2014.09.04 7751
40 HTML5 Web Storage -01- file 2014.09.04 5587
39 HTML5 Speech Input (음성인식) API 2014.09.04 6454
38 HTML5 Geolocation (구글 지도에 현위치 표시하기) file 2014.09.04 6810
Board Pagination Prev 1 ... 4 5 6 7 8 9 10 11 12 13 Next
/ 13

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

© k2s0o1d4e0s2i1g5n. All Rights Reserved