android-listview

Inverted ListView in Android?

折月煮酒 提交于 2019-12-17 20:07:07
问题 Is there an easy way to display a ListView in reverse order? I am trying to create a conversation-based app, and would like the most recent entries to be at the bottom of the ListView. I am aware of transcriptMode and stackFromBottom, however my problem is the order of the data. Say I have 100 conversation items, and want to display items 80-100, with 100 being the most recent conversation item. I would like to show 80-100, which implies an ORDER BY id desc LIMIT 20 in my query, which forces

Android: Customize list view, Table view in adapter

允我心安 提交于 2019-12-17 19:57:05
问题 I created a table view in list view adapter programmatically. For that first i created a Adapter layout as : <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/black" android:stretchColumns="*" android:id="@+id/tablelayout" > </ableLayout> Then what I have done in the adapter is: public class DemoAdapter extends ArrayAdapter

get clicked item from listview

给你一囗甜甜゛ 提交于 2019-12-17 19:39:19
问题 I've got a problem. Before modification in my XML file, my listview was able to work perfectly. But now, after some modifications in xml, its not working properly. My listview is custom. So, i've created separate xml to render every single row in the listview. My single row.xml code: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:id="@+id/relativeLayoutSingleRowManageAddictions" android:layout_height="40dp" android

Android Listview Measure Height

拥有回忆 提交于 2019-12-17 19:05:08
问题 I'm trying to find a way to set the height of a listview based on the height of its children items. I followed the solution given here: How can I put a ListView into a ScrollView without it collapsing? public void setListViewHeightBasedOnChildren(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter == null) { // pre-condition return; } int totalHeight = 0; for (int i = 0; i < listAdapter.getCount(); i++) { View listItem = listAdapter.getView(i, null, listView)

Android Listview show only one item

北战南征 提交于 2019-12-17 18:27:40
问题 I have a ListView, where i changed appearence of row, but listview have size of one row, instead of fullscreen. list_item.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content"/> <LinearLayout android:layout_width="fill_parent" android

Playing video using textureview in recyclerview

旧时模样 提交于 2019-12-17 17:33:40
问题 I am trying to implement a list with videos like vine or Instagram app. Where they play video plays when list item is shown or fully visible and video pauses when list item gets hided. I am using textureview with media player to play a video from url and added it as list item in recyclerview. Following is my code. VideosAdapter Class: public class VideosAdapter extends RecyclerView.Adapter<VideosAdapter.ViewHolder> { Context context; private ArrayList<String> urls; public static class

Android - Highlight a Word In a TextView?

前提是你 提交于 2019-12-17 17:31:20
问题 I have a database search query which search in the database for a word entered by the user and return a Cursor . In my ListActivity , I have a ListView which will hold the items (the Cursor items). The ListView items layout is basically a TextView . I mean, the ListView will be a list of TextView 's. What I want is to highlight the search term wherever it appears in the TextView . I mean by highlighting: different color or different background color or anything makes it different than the

Add margin above top ListView item (and below last) in Android

霸气de小男生 提交于 2019-12-17 17:24:00
问题 This is a pretty fine question about the layout of items in a ListView in Android. I have an activity with a title bar at the top and a ListView taking up the rest of the screen. I want my ListView to appear with 10dp padding on the left, right and top, but when you scroll the ListView up, I want it to cover the top 10dp padding before disappearing under the faded edge. Similarly, when you scroll to the bottom, the last list item should appear with 10dp between the bottom of the last list

android change listview font and color

让人想犯罪 __ 提交于 2019-12-17 16:59:24
问题 I've found loads of different ways of accomplishing this but I'm not sure what's the best for my scenario. This is my Java code for the listview: ListView lv; lv = (ListView) findViewById(R.id.favList); This is the xml code for the list: <ListView android:id="@+id/favList" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="40dp" android:layout_marginLeft="30dp" android:layout_marginRight="30dp" android:layout_marginTop="20dp" android

list view position is getting changed when scrolling on android

隐身守侯 提交于 2019-12-17 16:35:20
问题 I have list view [text view and check box controlls] with more data. I will choose the item from list view and display the selected items in the next activity. My problem is, for the example if I choose 20th and 25th item in the list view it will display some other items in the next activity. That is list view position is getting changed when scrolling. i am choosing an item by clicking the check box on the item. in the checkbox.setOnChanged listener i wrote code for which position is