アプリケーションでandroid-wheel http://code.google.com/p/android-wheel/を使用しています。
画面に 3 つの車輪が並んでいます。ホイール内のテキストがホイールよりも広い場合、横にスクロールしたい(マーキーによる)
AbstractWheelTextAdapter
私は次のようにアイテムのカスタムを実装して作成しましたScrollingTextView
: (ScrollingTextView
アイテムにフォーカスがある場合にのみマーキーが機能するという問題を克服することです)
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"/>
これを機能させることができた人はいますか?
(私は成功せずにコードで楕円を設定しようとしました)AbstractWheelTextAdapter