gridview

Android GridView OnItemLongClick listener called after OnItemClick

巧了我就是萌 提交于 2020-01-01 05:50:25
问题 Basically I want to show a different context menu when the user short clicks or long clicks on a cell in the grid view. The issue I have is that if the user short clicks the OnItemClick listener is called and I see the debugger reach the code that shows the context menu but rather than moving from there to onCreateContextMenu it goes to onItemLongClick. I have tried using a Boolean to prevent the long click code being executed which does prevent that code being executed, however even when

ObjectDataSource Gridview Insert Fails W/ Empty Values Dictionary

≯℡__Kan透↙ 提交于 2020-01-01 05:48:07
问题 I have a gridview to which I have created an Insert Template in the footer row. I have an ObjectDataSource which is bound to a business object. I have an OnInserting event handler which never gets fired. The program encounters an error once I call .Insert on the ObjectDataSource. The error I receive is that there are no values and that I should check to make sure the values dictionary is not empty. I do not see a way to insert with a dictionary as a parameter. I have seen mention of grabbing

How to get the number of rows of a GridView?

最后都变了- 提交于 2020-01-01 02:10:53
问题 Is there a way to get the row count of a GridView for Android API Level 8? 回答1: I had to solve this last night and it worked for me. It looks up a child's width and assuming all cells have the same width, divides the GridView's width by the child's width. ( getColumnWidth() is also unavailable in earlier APIs, so hence the workaround). private int getNumColumnsCompat() { if (Build.VERSION.SDK_INT >= 11) { return getNumColumnsCompat11(); } else { int columns = 0; int children = getChildCount()

Dynamic GridView items in Android

泄露秘密 提交于 2020-01-01 00:52:31
问题 Hey i'm trying to build an app in which the user can input some numbers and these numbers will be shown in a gridview with custom grid view items. If i use the common gridview items of android it works. But if i use my own layout it doesnt work. Only the first element in the array will be shown. Does anybody have a clou why this doesn't work? public class GridViewAppActivity extends Activity { private ArrayList<String> items; private GridViewAdapter adapter; /** Called when the activity is

Getting an object back from my GridView rows

爷,独闯天下 提交于 2019-12-31 22:03:01
问题 Basically, i want my object back... I have an Email object. public class Email{ public string emailAddress; public bool primary; public int contactPoint; public int databasePrimaryKey; public Email(){} } In my usercontrol, i a list of Email objects. public List<Email> EmailCollection; And i'm binding this to a GridView inside my usercontrol. if(this.EmailCollection.Count > 0){ this.GridView1.DataSource = EmailCollection; this.GridView1.DataBind(); } It would be really awesome, if i could get

Yii2 Gridview row by row css expression

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-31 21:27:17
问题 What is the correct way to do a row by row css expression. In Yii 1 is was rowCssClass. I couldn't figure out how to achieve this with Yii2. I had tried this, but wasn't sure I was on the right lines: 'rowOptions' => function($model, $key, $index, $grid){ if($data->option->correct_answer == 1){ return ['class' => 'danger']; } }, I'm unsure where to get the parameters for the function from when dealing with the dataProvider though. 回答1: Use $model instead $data. In my variant: 'rowOptions' =>

Maintain Scroll Bar position of a div within a gridview after a PostBack

社会主义新天地 提交于 2019-12-31 17:22:12
问题 I used the following piece of code in the web.config in order to maintain the scrollbar position after a server postback: <pages maintainScrollPositionOnPostBack="true" > </pages> All is working fine, but now i have a gridview encapsuled within a div with a scrollbar in the div (internal scrollbar). When an event occur on one of the rows inside the gridview, the internal scrollbar doesn't maintain its original position unlike the outer one. Any ideas? 回答1: For future reference: The normal

Maintain Scroll Position of GridView through Screen Rotation

a 夏天 提交于 2019-12-31 12:59:47
问题 How can I maintain the scroll position of a GridView (it's filled with search results) throughout a screen reorientation? I have the GridView inside a Fragment, and when I rotate the screen it jumps back up to the top of the list. To make it even more tricky, in landscape mode my GridView has 3 columns.. in portrait mode it has 2 columns. I can't seem to figure out how to keep the fragment's GridView scrolled to anywhere near where it should be when the screen orientation changes. 回答1: You

Checkbox for gridview inside listview in Android

夙愿已清 提交于 2019-12-31 07:44:49
问题 I have a problem statement in my booking app such that user can delete all the booking of the particular date or all the dates, see this image: I have tried to add data to the grid view using multiple adapters for listview and the inner gridview, but it's taking data replication. How can I solve this problem? Each date represents the listview with checkbox,and the UH,U1 etc represents the item of gridview. I want to pass the selected venue id ie. UH,U! etc in a listview and its corresponding

Checkbox for gridview inside listview in Android

夙愿已清 提交于 2019-12-31 07:44:06
问题 I have a problem statement in my booking app such that user can delete all the booking of the particular date or all the dates, see this image: I have tried to add data to the grid view using multiple adapters for listview and the inner gridview, but it's taking data replication. How can I solve this problem? Each date represents the listview with checkbox,and the UH,U1 etc represents the item of gridview. I want to pass the selected venue id ie. UH,U! etc in a listview and its corresponding