Xamarin. listview click on button inside list item - android-listview

I am creating a listview which has many elements and one element is expand button. When I click on expand button i want to show some more button which are hidden with each list item. ( i.e each list item has separate buttons)
I know how to add click event with button inside listview item
in my custom adapter ..
getView(){
var expandBtn = findViewById(_)..
expandBtn.click += (sender,e)=>{
// this block should do show hide of my other buttons.
// how to get them here.
};
}

Related

Flutter ShowDialog to show correct data once

I have a working method that places Map Markers on a HERE map in Flutter
When an individual marker is pressed it pops up with a metadata box containing relevant data
Depending on which List type of marker is pressed I will trigger a different ShowDialog to show the correct data
I have a Flutter Gesture Handler that listens for taps and then reacts.
I need different _pickMapMarker*x* to be options (in 'Gesture Handler')depending on the list type of marker pressed
All markers are added to a list, List<MapMarker> _x when placed, there is list _mapMarkertype1, _mapMarkertype2
This is what I currently have. The issue is as follows... If there are 12 mapMarkers in the List the marker I click displays 12 pop-ups, all with the correct information, just duplicated 12 times (Or as many markers in List when button pressed)
I need to display just the info from the selected pop-up one time, in one pop-up
Here is the method (Which is by no means correct, just the nearest I have got. I think rather than contains, I need it the other way around, to check which list the tapped marker is in)
void _setTapGestureHandler() {
_hereMapController.gestures.tapListener = TapListener((Point2D touchPoint) {
for(MapMarker mapMarker in _mapMarkerList1) {
if (_mapMarkerList1.contains(mapMarker)) {
_pickMapMarker1(touchPoint);
}
}
for(MapMarker mapMarker in _mapMarkerList2) {
if (_mapMarkerList2.contains(mapMarker)) {
_pickMapMarker2(touchPoint);
}
});
}
Place marker
_hereMapController.mapScene.addMapMarker(mapMarker);
_mapMarkerList2.add(mapMarker);
}

How to implement Expand/Collapse for a table with Multiple columns - GWT - Google Visualization API

I have list of Items with parent child relation.
At present I am displaying them in a single table. In each row, fist column starts with number of '-'s indicating the depth.
Now I want show only top level items first and with a '+' button before that.
When the user clicks on the '+' button it should turn to '-' and the children of that particular Item need to be displayed.
So, Please help me how to implement that Expand and Collapse functionality in GWT.
EDIT:
I have my Items in a tree format.
Now I am creating a DataTable and Displaying it using GoogleTableChart
The code as follows:
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, "Item Name ");
data.addColumn(ColumnType.STRING, "Item Id");
data.addColumn(ColumnType.NUMBER, "Quantity");
data.addColumn(ColumnType.NUMBER, "Price ($)");
data.addRows(treeList.size());
int i=0;
while(i<treeList.preOrderTraversal().size())
{
int col=0;
Item d=(Item) treeList.preOrderTraversal().get(i);
int level=d.getLevel();
//setting values to DataTable goes here
i++;
}
GoogleTableChart tblChart = new GoogleTableChart();
vPanel.add(tblChart.showFlexibleTable1(data));
Here is my solution:
I create Nested VertialPanels for each Item. And put the reference in a map.
Hide/unhide the panels based on clicks.
For root Item take one panel and add all its children.
After adding one child, add all its children to another panel,hide it and add to root panel.
repeat the steps recursively.
before each row place put (+/-) label and add click handler which take item id as parameter.
when these lables are clicked, based on the status we hide/unhide the panels, taken from the map.
Any Better Solution ... ??

Change style of first item in listview

I have a list of items in a listView. I would like to highlight the first item of this listview so that the user knows top item is active. How can I go about doing this?
Something like the image
Try Some like tha:
create custom listview adapter like that and adapter, Custom adapter for a list of items that have multiple child items?
then set bg like that:
if (position == 0) {
// define layout here list 1st item
view.setBackground(R.drawable.bg);
} else {
// others
view.setBackground(R.drawable.bg);
}

Menu or MenuButton with separate click handler

I'm looking for a widget like this.
http://ppt.cc/RPfL
Clicking "View" and triangle (drop down icon) need to perform two different functions.
Clicking the triangle opening the menu.
I tried creating 2 buttons to emulate, but the 2 buttons have extra space in between them.
How can I eliminate the space between buttons or, is there a convenient way to accomplish this?
thank you all!!
An IconMenuButton (which is a sub class of IconButton) will provide what you need.
Menu menu = new Menu();
MenuItem newItem = new MenuItem("New");
MenuItem openItem = new MenuItem("Open");
MenuItem saveItem = new MenuItem("Save");
MenuItem saveAsItem = new MenuItem("Save As");
menu.setItems(newItem, openItem, saveItem, saveAsItem);
IconMenuButton menuButton = new IconMenuButton("View", menu);
Also check SmartGWT samples I've given in my comment and RibbonBar sample.

How do I prevent multiple columns on SWT Vertical ToolBar?

I'm creating a vertical SWT ToolBar:
ToolBar toolBar = new ToolBar( parent, SWT.RIGHT | SWT.VERTICAL );
And then adding items to it:
for ( MyObject myObject: myObjects ) {
ToolItem toolItem = new ToolItem( toolBar, SWT.NONE );
toolItem.setText( myObject.getLabel() );
toolItem.setImage( myObject.getImage() );
}
The toolbar is created correctly, but as some labels are too long, there are some cases in which new items are created on a second column, in front of the previous item.
So, instead of getting a toolbar that looks like
Item with a very long label
Tiny item
Little item
I get a toolbar that looks like
Item with a very long label
Tiny item Little item
If the long label is long enough, a third column will appear.
Does anyone know if there's a way to prevent the creation of a new column on the toolbar?
Thank you.