02-21-2013 12:15 PM
I want to show listview header in Horizontally centerd and give a background color to it? I tried but its not working
Solved! Go to Solution.
02-21-2013 03:30 PM - edited 02-21-2013 03:57 PM
You can refer with this article :
http://developer.blackberry.com/cascades/documenta
I found this solution works
ListItemComponent {
type: "header"
Container {
background: Color.xxx or Color.create("#xxxxxx")
layout: StackLayout {
}
Label {
text: something
horizontalAlignment: HorizontalAlignment.Center
}
}
}
02-22-2013 02:38 AM
I have done the same thing.But the label is on left side and background is only upto label text,its not covering whole area
02-22-2013 02:33 PM
I found that it works at my side. May you attach the listview implementation in your source code?
02-22-2013 11:34 PM
Here is the code:
NavigationPane{
id:nav
Page {
propertystringpagetitle:""
Container {
//CONTAINER FOR CUSTOM PAGETITLE
Container{
background:Color.DarkGray
horizontalAlignment: HorizontalAlignment.Fill
preferredHeight:100
layout: StackLayout {
}
Label{ horizontalAlignment: HorizontalAlignment.Center
text:"Furniture"
textStyle.fontSize: FontSize.PointValue
textStyle.fontSizeValue: 12
}
}
Container{
ListView{
id: scoreList
objectName: "scoreList"
dataModel: scoreModel
layout: StackListLayout {
headerMode: ListHeaderMode.Sticky
}
listItemComponents: [
ListItemComponent {
type: "item"
StandardListItem {
imageSpaceReserved: false
title: ListItemData.option
}
},
ListItemComponent {
type: "header"
Container {
background: Color.Gray
layout: StackLayout {
}
Label {
text: ListItemData
horizontalAlignment: HorizontalAlignment.Center
}
}}
]
onTriggered: {
// When an item is selected, we push the recipe Page in the chosenItem file attribute.
var chosenItem = dataModel.data(indexPath);
_mineapp.setPageTitle(chosenItem.option);
_mineapp.setPageImg(chosenItem.optionimage);
console.log(indexPath+"PATH:"+chosenItem.option)
// Set the correct file source on the ComponentDefinition, create the Page, and set its title.
var page = picpage.createObject();
// page.title = chosenItem.title;
// Push the new Page.
// picpage.open();
nav.push(page);
}
attachedObjects: [
// A GroupDataModel is used for presenting the SQL data. All set up is done here
// except for the actual population of the model, which is done in C++.
ComponentDefinition {
id: picpage
source: "Pic.qml"
},
GroupDataModel {
id: scoreModel
objectName: "scoreModel"
grouping: ItemGrouping.ByFullValue
sortingKeys: ["heading","option"]
}]
}
}
}
}
}
02-24-2013 12:15 PM
Anyone who can help?
02-24-2013 01:23 PM
Hi,
Please given container size means width full as per screen width.I hope they conver all part with gray color.
Thanks,
Umang.
02-25-2013 09:59 AM
it worked.Thanks
02-25-2013 10:04 AM
I just found only add a divider after your label without setting up full width, it also works.
Divider {
}
02-25-2013 10:57 AM
Yes,that too worked
thanks