android - TextView Marquee and Digital Clock -
when use digital clock
, textview marquee
, textview marquee
not work- , if remove digital clock works perfectly.
textview tv = new textview(this); tv.setlayoutparams(paramssong); tv.setellipsize(truncateat.marquee); tv.setfocusableintouchmode(true); tv.setfreezestext(true); tv.setsingleline(true); tv.setmarqueerepeatlimit(-1); tv.settext("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); tv.setselected(true); rl.addview(tv); digitalclock dg = new digitalclock(this); rl.addview(dg); /*if remove digital clock works*/
can not use both @ same time or there solution?
yes can use these first correct mistakes
1. adding view rl.addview(tv);
2 times
2. set height
, width
of digitalclock
try following code working fine me
textview tv = new textview(this); rl.addview(tv);// here mistake ! remove tv.setlayoutparams(paramssong); tv.setellipsize(truncateat.marquee); tv.setfocusableintouchmode(true); tv.setfreezestext(true); tv.setsingleline(true); tv.setmarqueerepeatlimit(-1); tv.settext("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); tv.setselected(true); rl.addview(tv);// adding view here absolutely right ! digitalclock dg = new digitalclock(this); dg.setheight(setheighthere); dg.setwidth(setwidthhere); rl.addview(dg);
ps. digitalclock class deprecated in api level 17
docs http://developer.android.com/reference/android/widget/digitalclock.html
this class deprecated in api level 17. recommended use textclock instead.
http://developer.android.com/reference/android/widget/textclock.html
Comments
Post a Comment