textview를 확장하는 컨트롤을 만들었습니다. 불행히도 내 활동에서 setText 또는 setTextSize와 같은 함수를 호출하려고해도 아무 일도 일어나지 않습니다.android는 재정의 된 textview 컨트롤에서 속성을 변경할 수 없습니다.
TextView l = (TextView) this.findViewById(R.id.dlgStarup_lblHeading);
myTextView lblHeading = new myTextView(l, _theme, _CONTROLTYPE.SUBTITLE);
myTextView.setText("Any text can go here"); //this doesn't work
하지만 그건 후 컨트롤의 속성을 설정 할 수 없다는 :
나는 표준 텍스트 뷰를 받아들이는 생성자를 만들고 다음 코드와 컨트롤을 작성하여 테마 문제를 해결하기 위해 관리 진짜 문제가 여기의 원인이 생성 된 것은 내 myTextView 클래스
public class myTextView extends TextView
{
public enum _CONTROLTYPE
{
TITLE,SUBTITLE,MESSAGE,LABEL,LARGE_LABEL,ICON;
}
public myTextView(TextView _t, myTheme _theme, _CONTROLTYPE _controltype)
{
super(_t.getContext());
this.setTheme(_t, _theme, _controltype);
}
public myTextView(Context _context, AttributeSet _attrs, int _defStyle)
{
super(_context, _attrs, _defStyle);
// TODO Auto-generated constructor stub
}
public myTextView(Context _context, AttributeSet _attrs)
{
super(_context, _attrs);
// TODO Auto-generated constructor stub
}
private void setTheme(TextView _control, theme _theme, _CONTROLTYPE _controltype)
{
_control.setTextColor(_theme.colours.titleText);
_control.setTextSize(_theme.fonts.getPointSize(myTheme._POINTSIZES.TITLE));
}
//this didn't work
public void setThemeOld(theme _theme, _CONTROLTYPE _controltype)
{
//I tried calling both this.setText.... and super.setText..., neither changed the apperance of my control
this.setTextColor(_theme.colours.titleText);
this.setTextSize(_theme.fonts.getPointSize(myTheme._POINTSIZES.TITLE));
//I also tried putting this here - it had no effect
this.invalidate()
}
}
(편집) 가득 요청에 따라 textviews가 initilized되는 코드 :
protected Dialog_Startup(Context _context, boolean _cancelable, OnCancelListener _cancelListener, theme _theme)
{
super(_context, _cancelable, _cancelListener);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.setContentView(R.layout.dialog_startup);
TextView l = (TextView) this.findViewById(R.id.dlgStarup_lblHeading);
myTextView lblHeading = new myTextView(l, _theme, _CONTROLTYPE.SUBTITLE);
l = (TextView) this.findViewById(R.id.dlgStarup_lblProgress);
myTextView lblMessage = new myTextView(l,_theme, _CONTROLTYPE.LABEL);
lblMessage.setText("THIS ISN'T WORKING"); //this isn't workig
Intent i = new Intent(_context, DataService.class);
//_context.startService(i);
}
에서 oncreate의 코드를 게시 할 수 있습니까? –