Change style of first item in listview - android-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);
}

Related

How could I add custom row focus class in ag-grid

I want to control row focus process. I need to show confirm dialog on row focus change in my table.
I tried to do this with rowClassRules property, but as I understood that functionality apply classes when table rendering, after that row classes stop changing
rowClassRules = {
'custom-row-focus': (params) => {
return params.data.id === this.currentSelectedItem.id
}
}
currentSelectedItem set's when I click on the row
Found an answer in docs
https://www.ag-grid.com/javascript-grid-row-styles/#refresh-of-styles
If you refresh a row, or a cell is updated due to editing, the rowStyle, rowClass and rowClassRules are all applied again.
So, when I'm clicking to the row I should make something like that:
onClicked($event: RowClickedEvent) {
$event.node.setData({...$event.data});
}

Xamarin. listview click on button inside list item

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.
};
}

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 ... ??

How to add Widget as a Cell in Cell Table GWT

Now I'm stuck in issue of pagination the widgets in GWT.
I'm using Cell table to display a list of instances of an UI Binder class of mine (Ex: LocationView).
http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTable
This is the showcase of the CellTable.
Now I want to add my widget (UI Binder class) to each cell of the table . It will look somehow like this
In this Cell Table, each cell is this widget (LocationView - an UI Binder Class):
So How can I create this table using cell table (I do not use grid view because it's not supported pagination)
or If I can not use Cell table to create this table, what I can use to it that supports pagnigation (if the number of LocationView (The icon you see) is over 6, it will jump to page 2).
Thank you for your help!.
Creating custom cells tutorial explains how to do that.
To add a widget to a cell I use custom CellTableBuilder and I set unique id for the cell that should contain a widget.
Then I attach the widget to DOM and move it to the cell.
void addWidgetToCell(final String cellId, final Widget widget) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
#Override
public void execute() {
Element cellElem = DOM.getElementById(cellId);
if (!widget.isAttached()) {
// attach the detail to DOM (cannot attach it directly to the cell, because it has existing parent widget)
RootPanel.get().add(widget);
}
// move detail element under the cell element
cellElem.appendChild(widget.getElement());
}
});
}

Monotouch: How can I set the selected item(s) in a UIPickerView?

I've successfully created a UIPickerView and am using a custom ListModel tu supply the selectable items. But how can I specify which of the items should be selected when the view appears?
Thanks,
Adrian
You have to call the picker view's Select method:
pickerView.Select(1, 0, true);
This will select the second row (index 1) of the first component (index 0). The boolean is for animating the selection or not.
See the documentation.