2011-11-01 2 views
0

사실 TextView에 텍스트가 있습니다. 이 텍스트를 이미지 통찰력을 삽입해야합니다. 가장 좋은 방법을 제안하십시오. 다양한 디스플레이 크기에서 지원되어야합니다.Android. 텍스트에 이미지를 삽입하는 방법

+0

가능한 중복 HTTP에서

android:background="@drawable/icon" 

만약이 속성을 추가 XML

통해 싶지 : // stackoverflow.com/questions/7913987/how-to-insert-imageview-at-the-end-of-multiline-textview – Vladimir

답변

1

당신이 그렇다면 다음 중 하나를 위/아래/오른쪽/왼쪽에있는 텍스트 뷰 내부 디스플레이 이미지에 대해 이야기 :

<TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Hello World, DemoExampleActivity!" 
     android:drawableLeft="@drawable/icon" 
     android:drawableRight="@drawable/icon" 
     android:drawablePadding="10dip"/> 

출력 :

enter image description here

0

당신은 설정할 수 있습니다 TextView의 배경 이미지는 다음과 같습니다.

<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Text to be displayed" 
    android:background ="@drawable/your_image" 
    /> 

행운을 빌어 요, Arkde

0

경우 텍스트 뷰 요소 런타임 프로그래밍 방식

TextView tv = (TextView)findViewById(R.id.textView); 
    tv.setBackgroundDrawable(drawable); 

      or 

    tv..setBackgroundResource(resid); 
관련 문제