-1
나는 텍스트 뷰의 값 변경할 수 있습니다맞춤 속성의 값을 변경하는 방법은 무엇입니까?
textTem = (TextView) findViewById(R.id.textTem);
textTem.setText("ssss");
을하지만 사용자 정의 속성을 가진 사용자 지정 구성 요소를 가지고 : "안드로이드 : 텍스트를"쉽게 때문이다.
내 사용자 지정 구성 요소 클래스 : XML의
public class DayItem extends RelativeLayout {
...
}
내 사용자 지정 구성 요소 :
<com.example.a28210.weathpredict.DayItem
android:id="@+id/days1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
item:dayweather="snow"
item:daymaxtem="-2°"
item:daymintem="-12°"
item:daydate="12.8" />
내 사용자 정의 속성 :
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="DayItem">
<attr name="daydate" format="string" />
<attr name="dayweather" format="string" />
<attr name="daymaxtem" format="string" />
<attr name="daymintem" format="string" />
</declare-styleable>
</resources>
내 질문은 : 변경할 수있는 방법이 없습니다 커스텀 속성의 값
acustom 속성의 값을 변경하려면 어떻게해야합니까?
DayItem d=(DayItem)view.findViewById(R.id.days1);
d. //?????
"acustom 속성의 값을 변경할 방법이 없습니다."- 추가하십시오. 당신은'com.example.a28210.weathpredict.DayItem'을 썼습니다. 거기에 메소드를 추가 할 수 있습니다. – CommonsWare
'setText' 메소드는 XML 정의에서 자동으로 생성되지 않습니다. –