i took ages for me to find a solution for this though it was hidden
somewhere in internet..
anyways the solution is to add the tag <requestFocus/> in your
textview:)
Eg:
<TextView
android:id="@+id/left_text_box_0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever">
<requestFocus/>
</TextView>
On Dec 2, 9:52 pm, Jared <[email protected]> wrote:
> I have this already in my xml layout:
>
> <TextView
> android:id="@+id/left_text_box_0"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:focusable="true"
> android:singleLine="true"
> android:ellipsize="marquee"
> android:marqueeRepeatLimit="marquee_forever"
> />
>
> This marquee works if I scroll up with the trackball on my widget to
> focus on the text. The only thing that I need to do now is find out
> how to set the focus programatically in the code. For an Activity or
> View, this can be done by using TextView.setSelected(true). For a
> RemoteView though, you can't use findViewById to get the TextView
> layout reference (For example: R.id.left_text_box0). Do you know a way
> to do this for a RemoteView?
>
> Here is another post describing the same thing I'm looking
> for:http://groups.google.com/group/android-developers/browse_thread/threa...
>
> Thanks for help.
>
> On Nov 25, 11:14 am, Mark Murphy <[email protected]> wrote:
>
> > Jared wrote:
> > > I have an HTC Hero from Sprint in the US and was curious about the how
> > > the Stocks HTC widget scrolls text like a ticker. It is only the 4x1
> > > sized widget that scrolls quotes. As far as I know, homescreen widgets
> > > can only use RemoteViews for the layout, which is limited to the
> > > following layouts and widgets (from
> > >http://developer.android.com/guide/topics/appwidgets/index.html#Creat...
>
> > > * AbsoluteLayout
> > > * FrameLayout
> > > * LinearLayout
> > > * RelativeLayout
> > > * AnalogClock
> > > * Button
> > > * Chronometer
> > > * ImageButton
> > > * ImageView
> > > * ProgressBar
> > > * TextView
> > > Descendants of these classes are not supported.
>
> > > I know that this could be done in an app with android.widget.scroller,
> > > but that can't be used in a homescreen widget. Would this
> > > functionality be specific to the Sense UI homescreen capabilities? I
> > > guess, my main question is if this can be replicated for a standard
> > > Android widget and if so how.
>
> > Look at the android:marqueeattribute on TextView, and see if that fits
> > your needs.
>
> > --
> > Mark Murphy (a Commons
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Warescription: Three Android Books, Plus Updates, $35/Year
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en