Materialdrawer: AccountHeader ν”„λ‘œν•„ 이미지가 URL을 톡해 λ‘œλ“œλ˜μ§€ μ•ŠμŒ

에 λ§Œλ“  2015λ…„ 10μ›” 06일  Β·  3μ½”λ©˜νŠΈ  Β·  좜처: mikepenz/MaterialDrawer

μ—¬λ³΄μ„Έμš”. μ–΄μ©Œλ©΄ λ‚΄κ°€ μ—¬κΈ°μ„œ λ©μ²­ν•œ 짓을 ν•˜κ³  μžˆλŠ” 것일 μˆ˜λ„ μžˆμ§€λ§Œ μ‹€μ œλ‘œ μž‘λ™ν•˜κ²Œ λ§Œλ“€ 수 μ—†κ³  이유λ₯Ό λͺ¨λ₯΄κ² μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같은 μ½”λ“œλ‘œ AccountHeader κ΅¬μΆ•ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

final ProfileDrawerItem profile = new ProfileDrawerItem().withName(mCurrentUserName)
    .withEmail(mCurrentUserEmail)
    .withIcon(mCurrentUserProfilePictureUrl);

AccountHeader header = new AccountHeaderBuilder().withActivity(this)
    .withHeaderBackground(R.drawable.drawer_header)
    .withActivity(this)
    .addProfiles(profile)
    .build();

λ˜ν•œ 짧은 방법을 μ‚¬μš©ν•˜μ—¬ 이 μž‘μ—…μ„ μˆ˜ν–‰ν–ˆμ§€λ§Œ(μƒˆ ProfileDrawerItem λ₯Ό AccountHeaderBuilder ) μ—¬μ „νžˆ κ²°κ³Όκ°€ μ—†μŠ΅λ‹ˆλ‹€.

λ‚˜λŠ” μ „λ‹¬ν•˜λŠ” 값에 λŒ€ν•΄ Log.d() μˆ˜ν–‰ν•˜κ³  있으며 값이 null이 μ•„λ‹ˆλΌκ³  ν™•μ‹ ν•©λ‹ˆλ‹€. 이름과 이메일은 μ •μƒμ μœΌλ‘œ ν‘œμ‹œλ˜μ§€λ§Œ ν”„λ‘œν•„ 사진을 ν‘œμ‹œν•˜λŠ” 데 λ¬Έμ œκ°€ μžˆμŠ΅λ‹ˆλ‹€. κΈ°λ³Έ 및 κ°•μ‘° μƒ‰μƒμ˜ κΈ°λ³Έ 이미지λ₯Ό ν‘œμ‹œν•˜κ³  λ‚΄κ°€ μ „λ‹¬ν•œ URL에 이미지λ₯Ό λ‘œλ“œν•˜μ§€ μ•ŠλŠ” 것 κ°™μŠ΅λ‹ˆλ‹€.

도와 μ£Όμ…”μ„œ κ°μ‚¬ν•©λ‹ˆλ‹€.

good to know question

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

이 단계λ₯Ό λ†“μΉœ 것 κ°™μŠ΅λ‹ˆλ‹€.
https://github.com/mikepenz/MaterialDrawer#load -images-via-url

λ˜λŠ” μƒ˜ν”Œ 앱에 λ‹€μŒκ³Ό 같이 ν‘œμ‹œλ©λ‹ˆλ‹€.
https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CustomApplication.java#L18

λͺ¨λ“  3 λŒ“κΈ€

이 단계λ₯Ό λ†“μΉœ 것 κ°™μŠ΅λ‹ˆλ‹€.
https://github.com/mikepenz/MaterialDrawer#load -images-via-url

λ˜λŠ” μƒ˜ν”Œ 앱에 λ‹€μŒκ³Ό 같이 ν‘œμ‹œλ©λ‹ˆλ‹€.
https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CustomApplication.java#L18

감사! 이미지 λ‘œλ”©μ€ λ“œλ‘œμ–΄ μ•„μ΄μ½˜μ—λ§Œ μ μš©λ˜λŠ” 쀄 μ•Œμ•˜λŠ”λ° ν”„λ‘œν•„ μ•„μ΄μ½˜μ—λ„ ν•„μš”ν•œ κΈ°λŠ₯이 μžˆλŠ” 것 κ°™μ•˜μŠ΅λ‹ˆλ‹€. μƒ˜ν”Œ μ•±μ—μ„œ κ·Έ 뢀뢄을 λ†“μ³€μŠ΅λ‹ˆλ‹€. μ˜¬λ°”λ₯Έ 방법을 μ•Œλ €μ£Όμ…”μ„œ κ°μ‚¬ν•©λ‹ˆλ‹€. 이 뢀뢄도 μœ μ§€ν•΄ μ£Όμ…”μ„œ κ°μ‚¬ν•©λ‹ˆλ‹€.

@toyongbanatero 문제 μ—†μŠ΅λ‹ˆλ‹€ ;)

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰