草庐IT

ListView1

全部标签

android - 带有 onListItemClick 的 ListView 中可点击区域的宽度

我正在尝试让ListView中的列表项可点击。目前它们是可点击的(见我的屏幕截图),但它们只能在文本占据的矩形内点击。我正在使用protectedvoidonListItemClick(ListViewl,Viewv,intposition,longid){对于可点击的列表项。这是我的list.xml:和我的row.xml:和here'sthescreenshotexample:(不允许新用户发布图片......提示......有一个超链接!)在list.xml中,Listview有android:layout_width="fill_parent"所以它应该是屏幕的全宽。(row.x

Android字母部分Listview像联系人应用程序li​​stview

现在有人可以帮助我如何看待我的观点吗?请帮助我,我太困惑了。这里是我的代码:--------电话簿ListView.xml在PhoneBookList.java文件中protectedvoidonCreate(BundlesavedInstanceState){//TODOAuto-generatedmethodstubsuper.onCreate(savedInstanceState);setContentView(R.layout.phonebooklistview);listView=getListView();adapter=newItemsAdapter(this);adap

android - 为 ListView 设置长按监听器

我有以下代码:publicclassMainActivityextendsListActivity{protectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);}protectedvoidonListItemClick(ListViewl,Viewv,finalintposition,longid){super.onListItemClick(l,v,position,id);}}我需要将其更改为onLi

android - 在 ListView 中创建类别?

如何像在首选项(PreferenceCategory)中那样在任意ListView中创建类别?我找到了呈现灰色TextView的android.R.layout.preference_category,但在Java代码的任何地方都没有提到它。 最佳答案 HowdoIcreatecategoriesinanarbitraryListViewlikethoseinPreferences(PreferenceCategory)?I'vefoundandroid.R.layout.preference_categorythatrenders

android - 无法使用自定义适配器在 ListView 中设置项目边距

我正在尝试为我的ListView中的项目设置可变的左边距。问题出现在我自定义的Adapter中的getView方法中:publicViewgetView(intposition,ViewconvertView,ViewGroupparent){if(convertView==null){Commentc=comments.get(position);convertView=inflater.inflate(R.layout.list_item,null);(TextView)convertView.findViewById(R.id.story)).setText(c.message)

android - 滚动时如何从服务器加载数据到 ListView ?

我有一个显示图像和文本的ListView。我想一次显示8个ListView行,从服务器下载数据。当用户滚动ListView时,我需要从服务器下载更多数据并在ListView中显示项目。我使用AsyncTask从服务器下载数据。@OverrideprotectedVoiddoInBackground(Void...params){getData();//getdatafirsttime.8dataitems.returnnull;}@OverrideprotectedvoidonPostExecute(Voidresult){super.onPostExecute(result);pd.

Android ListView - 在 'whole' 行位置停止滚动

抱歉,标题困惑,我无法非常简洁地表达问题......我有一个带有ListView的Android应用程序,它使用圆形/“无限”适配器,这基本上意味着我可以根据需要向上或向下滚动它,当它到达顶部或底部时,项目将环绕,让用户觉得他正在旋转一个无限长的(~100)重复项列表。此设置的要点是让用户选择一个随机项目,只需旋转/甩动ListView并等待查看它停止的位置。我减少了Listview的摩擦力,因此它的移动速度更快、时间更长,而且看起来效果很好。最后,我在ListView的顶部放置了一个部分透明的图像以遮挡顶部和底部的项目(从透明到黑色的过渡),让用户看起来好像在“选择”中间的项目,就好

android - 在 Android 上像 iPhone 邮件应用一样滑动 ListView 项目

我从Android开发开始,我试图创建一个ListView项目,其行为类似于此图像:.在最后一步,用户可以点击“更多”或“删除”,其他View将像上一步一样停留在那里,用户将能够向右滑动将View放回原处我已经尝试使用一些关于滑动关闭的教程,但我无法完成这项工作。有谁知道任何框架或某种方式来做到这一点? 最佳答案 尝试实现47degreeAndroid-SwipeListView。这非常适合您的要求。图书馆网址:https://github.com/47deg/android-swipelistview完整的工作示例:https:/

android - ListView 保持选中状态?

我有一个充满项目的ListView,在用户选择一个项目后它会亮起,然后恢复正常。有没有办法让用户在我的ListView中选择一个项目时它保持选中状态并突出显示? 最佳答案 显然“消失的选择”是设计使然;它叫做“touchmode”。我通读了那份文件,但仍然不明白为什么他们认为这是个好主意。我的猜测是,由于Android最初是为小屏幕设备设计的,他们希望您用列表填充屏幕,然后当用户单击某个项目时,移动到不同屏幕上的新列表。因此,用户不会意识到Android丢失了所选项。但是,如果您希望用户选择一个项目,然后在同一屏幕上显示有关该项目的

android - Expandable ListView 中的 hasStableIds ()?

我正在使用ExpandableListView创建应用程序,我引用了一些教程。hasStableIds()设置为false?使hasStableIds()为false的确切需要是什么? 最佳答案 hasStableIds()的文档IndicateswhetherthechildandgroupIDsarestableacrosschangestotheunderlyingdata.ReturnswhetherornotthesameIDalwaysreferstothesameobject它在您更改适配器的数据时使用,每次更改数据时