Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

click event incorrect after zoom listview #3

Open
chutrung opened this issue Jul 10, 2018 · 4 comments
Open

click event incorrect after zoom listview #3

chutrung opened this issue Jul 10, 2018 · 4 comments

Comments

@chutrung
Copy link

Hello Xjasz,

I tried your code, it worked.
But I found a problem after zoom list view.
I clicked the first item in listview to show content (purpose item just is a string) after I zoomed listview. But the second item's content showed.
I tried fix this problem but didn't work.
So, could you share your opinion and solution?

Many thanks.

@Xjasz
Copy link
Owner

Xjasz commented Jul 10, 2018 via email

@chutrung
Copy link
Author

Hello Xjasz,

The following is code that i implemented:
MainActivity.java file

public class MainActivity extends AppCompatActivity {
    String arr[]={"Today","is","a","beautiful","day"};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ZoomListView  zoomListView = findViewById(R.id.zlv);
        ArrayAdapter<String> adapter = new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,arr);
        zoomListView.setAdapter(adapter);

        zoomListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Toast.makeText(MainActivity.this,arr[position],Toast.LENGTH_SHORT).show();
            }
        });
    }
}

And activity.xml file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.trungchu.zoomlistview.ZoomListView
        android:id="@+id/zlv"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

</LinearLayout>

After I zoom out the listview, I clicked the first item but a toast with string "is" showed.
Best regards,

@Xjasz
Copy link
Owner

Xjasz commented Jul 10, 2018 via email

@chutrung
Copy link
Author

Thanks for your answer.
I'm a newbee, Could you teach me how do I to do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants