마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

초보질문 textView에 관한.....질문있쨔요

0 추천
보통 텍스트뷰에 이미지배경 설정할때 xml에서 background로 설정해주자나요.

 

이걸 자바 소스로는 어케 해야하나요?

drawable폴더안에 a10.jpg라는 그림파일이 있다는 가정하에...

TextView 이름은 jojo라는 가정하에.....

 

예전에 어디서 본것 같은데 생각이 안나요..찾지도 못하겠고..
앤드류이드 (6,190 포인트) 님이 2013년 10월 25일 질문

1개의 답변

0 추천
 
채택된 답변

tv 가 TextView 일 경우를 가정해

http://developer.android.com/intl/ko/reference/android/widget/ImageView.html

tv.setBackgroundResource(R.drawable.[image id]);

직접 drawable  이나 bitmap 을 설정하는 것은 검색해보세요

void setBackground(Drawable background)
Set the background to a given Drawable, or remove the background.
void setBackgroundColor(int color)
Sets the background color for this view.
void setBackgroundDrawable(Drawable background)
This method was deprecated in API level 16. use setBackground(Drawable) instead
void setBackgroundResource(int resid)
Set the background to a given resource.

 

aucd29 (218,390 포인트) 님이 2013년 10월 25일 답변
앤드류이드님이 2013년 10월 25일 채택됨
...