Я использую Android-колесо http://code.google.com/p/android-wheel/ в приложении.
У меня три колеса рядом на моем экране.Когда текст в колесе шире, чем в колесе, я бы хотел, чтобы он прокручивался в сторону (в соответствии с выделением)
Я реализовал AbstractWheelTextAdapter
и создал пользовательский ScrollingTextView
для элементов следующим образом.: (ScrollingTextView
- решить проблему с помощью Marquee, работающей только тогда, когда элемент имеет фокус)
public class ScrollingTextView extends TextView {
public ScrollingTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public ScrollingTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ScrollingTextView(Context context) {
super(context);
}
@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
if(focused)
super.onFocusChanged(focused, direction, previouslyFocusedRect);
}
@Override
public void onWindowFocusChanged(boolean focused) {
if(focused)
super.onWindowFocusChanged(focused);
}
@Override
public boolean isFocused() {
return true;
}
}
И xml:
<com.test.app.ScrollingTextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id = "@+id/wheel_text"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:inputType="text"
android:scrollHorizontally="true"
android:textColor="#F000"
android:lines="1"
android:focusable="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusableInTouchMode="true"/>
Имееткто-нибудь смог заставить это работать?
(я также попытался установить Ellipse в коде для AbstractWheelTextAdapter
без успеха)