막혔습니다. 레이아웃에서 코드 TextViews에서 추가합니다. 나는 요소 목록을 가지고 있고 TextViews는 목록의 요소들에 의존한다. 이것은 잘 동작합니다. 이 textviews에는 다양한 색상의 배경이 있어야하고 이름에 따라 달라 지므로 문제가 발생했습니다. 나는 색상을 변경할 수 없습니다 배경 안드로이드에서 색상이 다른 모서리가있는 텍스트 뷰를 생성하기위한 아이디어
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="1dp"
android:color="@color/common_border_color" />
<solid android:color="#ffffff" />
<padding
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<corners android:radius="5dp" />
</shape>
를 사용하는 경우 그래서
<resources>
<string-array name="colors">
<item>#ff0000</item>
<item>#00ff00</item>
<item>#0000ff</item>
</string-array>
</resources>
에 6 색을 정의했습니다. 아이디어가 있으십니까? 당신의 TextView
의 배경이 shape
경우
. 모든 텍스트 뷰는 둥근 배경과이 배경의 다른 색상을 가져야합니다. 예 : 첫 번째 텍스트 뷰에는 노란색 배경, 두 번째 빨간색 배경 등이 있습니다. 모든 배경은 둥글게됩니다. – edi233