Wisdom8888 / android-wheel

Automatically exported from code.google.com/p/android-wheel
0 stars 0 forks source link

Hiden items; marquee effect in TextView #30

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What version of the product are you using? On what operating system?
I have tried Android 2.3.5, 3.2.1, 4.0.3, compiled with 2.3 SDK or 3.2 SDK.

Please provide any additional information below.

This is one of the amazing projects I ever seen in android!
Thanks the author!

Recently, I am trying to use this wheel widget in my own project.
But I encountered some problems about using this widget.

Issue 1:
The items in one wheel may disappear in the situation 
of the height of wheel is too long.

For example, in the CitiesActivity of wheel-demo project,
I set the height of R.id.country for "210dp", at that time,
the wheel may disappear during moving the wheel over-scroll down.

A video to demonstrate this issue:
http://youtu.be/d4ClwKixdmE

About this issue, I have employed a workaround modification.
I skip the calling of "rebuildItems()" in the function of
updateView() in "WheelView.java" during MotionEvent.ACTION_MOVE.

That can solve this issue in my case, but I don't know whether
it is a good manner or not.

Issue 2:
I want to add marquee effect in the TextView in wheel widget.

For example, the R.id.city in CitiesActivity, I created a custom
adapter view which contains a TextView that have marquee attribute
enabling.
But it can't do what I want.
I tried to call "textView.requestFocus()" or other functions that
set some attributes of "textView" in AbstractWheelTextAdapter.getItem(),
but also in vain.
I also tried to call "textView.requestFocus()" in "WheelView.addViewItem()",
but also in vain, 

I employed the same adapter layout in other normal ListView, it can perform the 
marquee effect.

Following code is my layout:
    <TextView
        android:id="@+id/main_content_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="TextView"
        android:gravity="center_vertical|center_horizontal"
        android:layout_centerVertical="true"
        android:textSize="50dip"
        android:ellipsize="marquee"
        android:singleLine="true"
        android:marqueeRepeatLimit="marquee_forever"
        android:focusable="true"
        android:focusableInTouchMode="true" />

Thank for your any suggestions in advance!
Eric

Original issue reported on code.google.com by yksix0...@gmail.com on 3 Feb 2012 at 4:39

GoogleCodeExporter commented 8 years ago
Did you figure it out? I face the marquee effect in TextView too,it didn't 
function in the wheelView.

Original comment by yoghourt...@gmail.com on 16 May 2014 at 10:12

GoogleCodeExporter commented 8 years ago
I figure it out. Because the WheelView didn't invalidate itself.In Activity,add 
the code : 
                 Handler handler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                super.handleMessage(msg);
                wheelview.invalidate();
                sendEmptyMessageDelayed(0, 0);
            }
        };  
        handler.sendEmptyMessage(0);
Then the TextView Marquee effect works.

I had try the TextView Marquee effect in ListView, the Marquee effect works.I 
gonna check the ListView  source code ,see what differences between ListView 
and WheelView.

Original comment by yoghourt...@gmail.com on 19 May 2014 at 10:06