메뉴 건너뛰기

?

단축키

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
번호 제목 날짜 조회 수
97 안드로이드 - 액티비티(Activity)와 액티비티 생명 주기(Activity Life Cycle) file 2021.04.01 225
96 안드로이드 - 에디트텍스트(EditText) 사용법 정리 file 2021.03.29 2758
95 안드로이드 - 옵션 메뉴 (Option Menu) 구현 방법 file 2021.04.01 283
94 안드로이드 - 익명 클래스(Anonymous Class) 사용법 file 2021.03.31 281
93 안드로이드 - 인텐트(Intent)를 활용한 액티비티(Activity) 생성 및 실행하기 file 2021.03.31 213
92 안드로이드 - 인텐트(Intent)를 활용한 액티비티(Activity)간 데이터 전달하기 file 2021.03.31 349
91 안드로이드 - 커스텀 폰트(Custom Font) 적용하기 file 2021.04.02 344
90 안드로이드 - 컨텍스트 메뉴(Context Menu) 사용 예제 file 2021.04.01 207
89 안드로이드 - 타이머(Timer) 구현하기 2021.04.01 1369
88 안드로이드 - 텍스트뷰(TextView) 사용법 정리 file 2021.03.31 1254
87 안드로이드 - 토스트(Toast) 메시지 사용하기. file 2021.03.31 325
86 안드로이드 - 툴바(ToolBar)를 사용하여 앱바(App Bar) 구현하기 file 2021.04.01 455
85 안드로이드 - 프래그먼트 (Fragment) 사용하기 file 2021.04.02 486
84 안드로이드 - 프레임레이아웃 (FrameLayout) file 2021.03.29 517
83 안드로이드 - 프로그레스바(ProgressBar) 구현하기 file 2021.04.01 451
82 안드로이드 - 플로팅 액션 버튼(Floating Action Button) 사용법 file 2021.04.02 971
81 안드로이드 android 개발 와이파이 유지 관련 2015.07.16 7034
80 안드로이드 arrayList 를 Json으로 변환 / jsonarry file 2021.03.29 326
79 안드로이드 EditText 필터링 검색 file 2015.12.14 7686
78 안드로이드 EditText 필터링 검색 구현(adapter.getFilter().filter(cs)) file 2015.12.14 8774
Board Pagination Prev 1 ... 4 5 6 7 8 9 10 11 12 13 Next
/ 13

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

© k2s0o1d4e0s2i1g5n. All Rights Reserved