listviewitem

Android - Get ListView item height?

删除回忆录丶 提交于 2019-11-28 20:26:57
问题 Is there a way to get ListViewItem height in code, when there is no actual items in list? My ListViewItem layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight"> ... </LinearLayout> I have tried to get it using Inflater: View convertView = LayoutInflater.from( this ) .inflate( R.layout.mail_list_row, null ); int itemHeight = convertView.getHeight(); But it's return 0;

How to define ColorStateList for TextView?

微笑、不失礼 提交于 2019-11-28 16:06:20
When my ListViewItem is highlighted, I want the text to turn white. How can I define this? <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:color="@color/testcolor1"/> <item android:state_pressed="true" android:state_enabled="false" android:color="@color/testcolor2" /> <item android:state_enabled="false" android:color="@color/testcolor3" /> <item android:color="@color/testcolor5"/> </selector> Konstantin Burov Create file res/drawable/text_color.xml: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item

How to Drag drop Listview item to another Listview

时间秒杀一切 提交于 2019-11-28 09:13:43
Hi I'm Raynast I'm a newbie for Android Programming Now I have a little problem from my project about Listview Drag and Drop I decide layout to Three Listview query from database _________________________ |list_1 |list_2 |list_3 | |_______|_______|_______| |_______|_______|_______| || ||| ||| || ||item1|||item5|||item8|| ||_____|||_____|||_____|| |_______|_______|_______| || ||| ||| || ||item2|||item6|||item9|| ||_____|||_____|||_____|| |_______|_______| | || ||| || | ||item3|||item7|| | ||_____|||_____|| | |_______| | | || || | | ||item4|| | | ||_____|| | | |_______|_______|_______| I use

android list view clickable problem

末鹿安然 提交于 2019-11-28 08:03:16
问题 i have this customized list. each row contains an image and two lines of text one below the other. i want to open a new activity when any list item is clicked. but i am not able to do so, even after implementing the setOnItemClickListener(). please correct me if i am wrong. the below is the code for the list. PS: This is an normal activity and not list activity. l1.setAdapter(new EfficientAdapter(this,eventTitleArray,eventDateArray,eventImageLinkArray)); //l1 = getListView(); l1.setClickable

How can I remove the selection border on a ListViewItem

两盒软妹~` 提交于 2019-11-28 00:05:12
问题 I'm using SetWindowTheme and SendMessage to make a .net listview look like a vista style listview, but the .net control still has a dotted selection border around the selected item: Selected items in the explorer listview don't have that border around them. How can I remove it? Windows Explorer: Edit: Solution: public static int MAKELONG(int wLow, int wHigh) { int low = (int)LOWORD(wLow); short high = LOWORD(wHigh); int product = 0x00010000 * (int)high; int makeLong = (int)(low | product);

Android ListView with RadioButton in singleChoice mode and a custom row layout

扶醉桌前 提交于 2019-11-27 23:27:39
I have a ListView , which is in singleChoice mode . All I want is to display a RadioButton to the side, that when clicked highlights to say it is selected, and when a different one is clicked that one goes back to unselected and the new one becomes selected. Why is this so hard? This should not be this complicated. I've spent DAYS looking for an appropriate answer to this and I have found nothing, so I'm asking hopefully in a clear and concise manner. My layout for the listview (R.layout.view_orders) : <?xml version="1.0" encoding="utf-8"?> <ListView android:choiceMode="singleChoice" android

Android ListView with RadioButton/CheckBox in singleChoice mode and a custom row layout

做~自己de王妃 提交于 2019-11-27 22:38:24
I have a ListView, which is in singleChoice mode. All I want is to display a RadioButton to the side, that when clicked highlights to say it is selected, and when a different one is clicked that one hides and the new one becomes selected. I looked in Mark's book, Chapter 8, "Getting Fancy With Lists" and his RateList example But it doesn't solve my problem. Please help me . EDIT Worth mentioning is that I had a custom layout on my list items: There is an icon, a title, a description and then the checkbox or radio button (depending on if it's a single or multiple choice list). My example

How can I set an icon for a ListViewSubItem?

六眼飞鱼酱① 提交于 2019-11-27 21:25:36
In a ListView you can have icons on each item. When viewing in Details-mode, the icon is shown in the left-most column. Can I show an icon in some other column? The ListView control does not support images in sub-items natively. The easiest thing to do is switch to a DataGridView and use a DataGridViewImageColumn . If that is not possible, then you'll need to draw the icons yourself using the custom draw support in the ListView control. To do this set ListView.OwnerDraw = true and handle the ListView.DrawSubItem and ListView.DrawColumnHeader events. private void listView1_DrawSubItem(object

Programmatically Select Item in Asp.Net ListView

若如初见. 提交于 2019-11-27 19:56:13
After doing a quick search I can't find the answer to this seemingly simple thing to do. How do I Manually Select An Item in an Asp.Net ListView? I have a SelectedItemTemplate, but I don't want to use an asp:button or asp:LinkButton to select an item. I want it to be done from a URL. Like a QueryString, for example. The way I imagine would be on ItemDataBound, check a condition and then set it to selected if true, but how do I do this? For example: protected void lv_ItemDataBound(object sender, ListViewItemEventArgs e) { using (ListViewDataItem dataItem = (ListViewDataItem)e.Item) { if

Android: How to hide a ListView Item

牧云@^-^@ 提交于 2019-11-27 19:47:06
How can you hide an item in a ListView or at least set its height to zero? I have tried setting the visibility of the View to GONE but it still maintains the item's space (height). Ressurecting an old question, but I just had this issue where I wanted to hide list items temporarily based upon criteria outside of the list data. What I ended up doing was creating a "null item" layout in xml and returned that based upon my criteria instead of the convert view in getView()... instead of returning the convertView, I returned my null_item... return inflater.inflate(R.layout.null_item, null); null