开发者

How to retrieve listview object used in a spinner.

开发者 https://www.devze.com 2023-03-24 07:01 出处:网络
I want to implement ListView.OnScrollListener on the listview used in the spinner dialog. However for this i need to get hold on the listview object used in the spinner.

I want to implement ListView.OnScrollListener on the listview used in the spinner dialog. However for this i need to get hold on the listview object used in the spinner.

Is there a way in which i can retrieve the object. Or i will have to customize a 开发者_StackOverflowdialog with a listview to give similar look and feel for this?

BR, Jayshil


As Sherif rightly pointed it out. No its not possible. :(

However, you can create a dummy dialog with a list in it and a single button.

You can use the below class copied from the somewhere, cant really recollect where.

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1" 
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical" 
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:paddingLeft="6dip" 
android:paddingRight="6dip"
android:textColor="#000000" 
android:textSize="14sp" 
android:maxLines="1"
android:ellipsize="end" />

And display this item on TouchListener for the spinner instead of the ClickListener. Somehow it never gets the first events in case of Android. Observed it on multiple layouts.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号