Change the background color for a selected item in a ListView?

Hello

No idea how to change the color of tbackground of a ListView selected item to blue for a different color?

I tried wrapping the ListView in a container, then by changing the background color of the container, but it does not work. And ListView, nor the ListItemComponent takes a background attribute.

Thank you

Oh, I did that last night.
Thus, in the container for StandardItem, add this line:

 background: ListItem.selected || ListItem.active ? Color.create("#4D9EC9") : Color.Transparent

and onTriggerred of the signal, add two lines:

// for highlighting
listView.select(indexPath, true);

// for clearing highlight
listView.clearSelection();

PS: listView is the id of the ListView

ListView {
    id: listView
....

Tags: BlackBerry Developers

Similar Questions

  • How can I change the background color for the bar 'help file edit view history bookmark tools' in Firefox 29,0

    How can I change the background color for the bar 'help file edit view history bookmark tools' in Firefox 29,0

    You can add a theme of solid color to change the color of the top of the browser window, which contains the Menu bar.

    https://addons.Mozilla.org/en-us/Firefox/themes/solid

  • Change the background color for amx-commandButtons

    I can't change the background color of amx-commandButton... even the css change... background still shows gray

    {.amx-commandButton

    position: relative;

    background-color: white;

    border-radius: 3px;

    white-space: pre wrap.

    -webkit-box-pack: center;

    content justify: Center;

    border: 1px solid #0572CE;

    }

    ..Screenshot_2015-08-06-17-06-28.png

    Ben.90, try adding a background picture: none for your css definition. Gray is a background image degraded in the skin of mobileAlta.

    The best way to debug and difficulty css - http://www.ateam-oracle.com/debugging-maf-applications-on-android/

  • How to change the background color for the text TreeField?

    Hello

    I call graphics.setBackgroundColor () of in the drawTreeItem() method, but it does not affect the background color of the graphics.drawText () method. Any ideas on how I can change the background color of text?

    Thank you

    I got this works using Graphics.drawFilledPath () to draw in a rectangle of background color before drawing the text.

  • How to change the background color for message

    Hi all
    Forms how can 10G I change the background color in the message box. ?
    I mean when I give a message like:-MESSAGE('HELLO'); then he comes in a window pop up.
    I want to change the color background back popup window.

    Published by: LuKKa Sep 22, 2010 15:36

    Create alerts using Navigator of the form object.
    Set the title and the message you have requested (or set the message on the duration of SET_ALERT_PROPERTY)
    To view your message, create a procedure like that...

    PROCEDURE MSGBOX(pMessage IN VARCHAR2) IS
      vAlert NUMBER;
    BEGIN
      SET_ALERT_PROPERTY('ALERT_NAME',ALERT_MESSAGE_TEXT,pMessage);
      vAlert:=SHOW_ALERT('ALERT_NAME');
    END;
    

    Now in your code, use like that...

    MSGBOX('Your message goes here...');
    

    -Clément

  • Change the background color in TableView selection

    Hi, does anyone know how to change the blue background color of a selected line in a TableView? Thank you in advance.

    If you look at caspian.css, you will see that the background color is affected by - fx-accent. So the best thing to do is to change the value of - fx-focus:

    view .table {-fx-accent: red ;}}

    Although I would advise against the inline styles, you can also do:

    TableView tv = new TableView();
    tv.setStyle ("focus - fx -: Red ;"); ")

  • How can I change the background color for the entire model

    I'm trying to change the color of gray background for the blue container. I tried to find the location of this gray background in the CSS, but failed.

    Could someone help me understand what line in the CSS file is responsible for the color of the container?

    Thank you

    Anna

    No worries.

    It seems that the background color is controlled by this tag in your style.css file:

    body #header body #footer {}

    background-color: #343434;

    }

    This can be consulted on line 1523 of this file. Change only the blue that you want and you should be good.

    I hope this helps.

  • Change the background color for the postPrint event

    I have a dropdown menu with a solid background (153, 203, 255) color.

    How can I change the color of white for event postPrint?

    Concerning

    Hello

    This is the script I use. Note that you must specify the reference of the user interface for the object type:

    var vName = this.somExpression;
    var fieldObj = xfa.resolveNode(vName + ".ui.#choiceList.border.fill.color"); 
    
    fieldObj.value = "255,255,255"; // white
    /* Check the type of object and change the .ui reference:
    
         Date field =      #dateTimeEdit
         Dropdown =      #choiceList
         Checkbox =      #checkButton
         Text field =      #textEdit
         Numeric field =     #numericEdit
    */ 
    
    Also the object has to have a background colour to start with. 
    
    Hope that helps,
    
    Niall
    
  • How can I change the background color for my site (newbie question)!

    Hi all

    I am completely new to Dreamweaver and to create my first website. I have a div container with a grey background color but I wanted the background of the body (IE outside that div) to be black. I'm displaying in Internet Explorer.

    I don't know that it's a simple solution - suggestions welcomed.

    The URL is http://www.fractionltd.com

    Thank you!

    David

    Take the ' # ' off the coast of the body... tag you apply a style to an id of the div to the body instead of the tag of the real body. That's why your color is not displayed.

  • How can I change the background color of a button in .qml

    Hello, everyone! I have a problem now.

    When I define a componnet in QML button, it has a white background color by default. While I want to change the background color, for example red.

       Container {
            layout: StackLayout {}
            background: backgroundPaint.imagePaint
            attachedObjects: [
                ImagePaintDefinition {
                    id: backgroundPaint
                    imageSource: "asset:///images/background.png"
                }
            ]
            Button{
                text: "button"
                verticalAlignment: VerticalAlignment.Center
                horizontalAlignment: HorizontalAlignment.Center
            }
        }
    

    I read the reference that write it a clickable button with a height fixed and the visual aspect of the button is predefined and cannot be changed and so forth... look herehttp://developer.blackberry.com/cascades/reference/bb__cascades__button.html

    I tried this way to change the theme of the application. But I failed! See more details here http://developer.blackberry.com/cascades/reference/bb__cascades__themesupport.html

    How can I achieve this? Please give me help. Thank you in advance. Please forgive my bad English

    Hello

    Button style is predefined according to me. Dark theme can be activated in the bar - descriptor.xml, but it is applied to the application on a global scale and affect all other controls as well.

    You can use a container with background image instead of a button. Example code:

    http://supportforums.BlackBerry.com/T5/Cascades-development/button-with-a-background-image/m-p/21489...

  • How to change the background color of the window?

    I would like to change the background color for all applications to pale gray,

    such as Notepad and IE.

    Anyone have any suggestions on how to do it?
    Thanks in advance for your suggestions

    Right-click on a zone empty of your desktop and choose personalize. When customization of the control panel applet opens, choose the color of the window (on the axis, below the pane). When the pane of the window color and appearance opens, click Advanced appearance settings (lower left corner of the pane).

    Now... with the Windows color and appearance of dialog box open, click on the white space of the Window Active (do not click the text in the window) or choose the command window of the point: in the drop-down list. Choose a color for 1 color:, e.g. Gray. Click apply at the bottom right and wait Windows 7 resets the graphic properties.

    If you now open Notepad, you'll have a gray window active. My IE follows suit, but only on a white page. Web designers in general choose the background image or color they want to view, and you will have to go into the options of the browser to replace those.

  • Change the background color of the Flex SDK 3.5

    How to change the background color for each word in a text box?

    for example:

    Line 1 should be red font with the green background color.

    Line 2 is black by default


    Line 3 is a blue font with the green background color.
    Line 4 is black by default

    You will need to expand the text box and replace the update display list,

    try to draw a rectangle, coloured in this method.

  • How to change the background color of selection of the selected item in the drop-down box of choice?

    How to change the background color of selection of the selected item in the drop-down box of choice?

    By default, the selection background color like 'blue', but if I want it to be "yellow" for example, how should I do?

    Thank you

    The id is applied by (I think) the skin of the ChoiceBox class. You don't need to define.

    You must apply the css in an external style sheet. You can apply the external style sheet to any parent of the box of your choice, or on-site (the most usual way to do it).

    Example:

    import java.util.ArrayList;
    import java.util.List;
    
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.control.ChoiceBox;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    
    public class ChoiceBoxTest extends Application {
    
      @Override
      public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("Example 2");
    
        final ChoiceBox choiceBox = new ChoiceBox<>();
    
        List tempResult = new ArrayList();
        for (int i = 0; i < 10; i++) {
          tempResult.add("Item " + i);
        }
        choiceBox.getItems().setAll(tempResult);
    
        VBox root = new VBox();
        root.getChildren().add(choiceBox);
        final Scene scene = new Scene(root, 300, 250);
        scene.getStylesheets().add("choiceBox.css");
        primaryStage.setScene(scene);
        primaryStage.show();
      }
    
      public static void main(String[] args) {
        launch(args);
      }
    
    }
    

    choiceBox.css:

    @CHARSET "UTF-8";
    #choice-box-menu-item:focused  {
     -fx-background-color: yellow ;
    }
    #choice-box-menu-item .label {
     -fx-text-fill: black ;
    }
    

    Post edited by: James_D

  • How to change the highlight color for windows 7 (select the file or folder)?

    How to change the highlight color for windows 7 in the aero theme (select the file or folder)?

    You can change the font size because it is not a widget.   To do this:

    1 type dpi in your Start menu search box, and then choose make text and other more or less important.
    2 - Choose a size you prefer
    3 - Click on apply.
  • How to change the background color of a line when you have the selection of cells in tableview?

    I have a tableview and I chose the selection of cells. How can I change the background color of a line, if I select a cell?

    The usual example using:

    import javafx.application.Application;
    import javafx.beans.binding.Bindings;
    import javafx.beans.binding.BooleanBinding;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.property.StringProperty;
    import javafx.collections.FXCollections;
    import javafx.collections.ListChangeListener.Change;
    import javafx.collections.ObservableList;
    import javafx.collections.ObservableSet;
    import javafx.css.PseudoClass;
    import javafx.geometry.Insets;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.SelectionMode;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TablePosition;
    import javafx.scene.control.TableRow;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.layout.VBox;
    import javafx.scene.text.Font;
    import javafx.stage.Stage;
    
    public class RowHighlightedCellSelectionTableViewSample extends Application {
    
        public static void main(String[] args) {
            launch(args);
        }
    
        @Override
        public void start(Stage stage) {
            Scene scene = new Scene(new Group());
            scene.getStylesheets().add(getClass().getResource("selected-row-table.css").toExternalForm());
            stage.setTitle("Table View Sample");
            stage.setWidth(450);
            stage.setHeight(500);
    
            final Label label = new Label("Address Book");
            label.setFont(new Font("Arial", 20));
    
            final TableView table = new TableView<>();
            final ObservableList data =
                FXCollections.observableArrayList(
                    new Person("Jacob", "Smith", "[email protected]"),
                    new Person("Isabella", "Johnson", "[email protected]"),
                    new Person("Ethan", "Williams", "[email protected]"),
                    new Person("Emma", "Jones", "[email protected]"),
                    new Person("Michael", "Brown", "[email protected]")
            );
    
            table.getSelectionModel().setCellSelectionEnabled(true);
            table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    
            final PseudoClass selectedRowPseudoClass = PseudoClass.getPseudoClass("selected-row");
            final ObservableSet selectedRowIndexes = FXCollections.observableSet();
            table.getSelectionModel().getSelectedCells().addListener((Change change) -> {
                selectedRowIndexes.clear();
                table.getSelectionModel().getSelectedCells().stream().map(TablePosition::getRow).forEach(row -> {
                    selectedRowIndexes.add(row);
                });
            });
    
            table.setRowFactory(tableView -> {
                final TableRow row = new TableRow<>();
                BooleanBinding selectedRow = Bindings.createBooleanBinding(() ->
                        selectedRowIndexes.contains(new Integer(row.getIndex())), row.indexProperty(), selectedRowIndexes);
                selectedRow.addListener((observable, oldValue, newValue) ->
                    row.pseudoClassStateChanged(selectedRowPseudoClass, newValue)
                );
                return row ;
            });
    
            TableColumn firstNameCol = new TableColumn<>("First Name");
            firstNameCol.setMinWidth(100);
            firstNameCol.setCellValueFactory(new PropertyValueFactory<>("firstName"));
    
            TableColumn lastNameCol = new TableColumn<>("Last Name");
            lastNameCol.setMinWidth(100);
            lastNameCol.setCellValueFactory(new PropertyValueFactory<>("lastName"));
    
            TableColumn emailCol = new TableColumn<>("Email");
            emailCol.setMinWidth(200);
            emailCol.setCellValueFactory(new PropertyValueFactory<>("email"));
    
            table.setItems(data);
            table.getColumns().addAll(firstNameCol, lastNameCol, emailCol);
    
            final VBox vbox = new VBox();
            vbox.setSpacing(5);
            vbox.setPadding(new Insets(10, 0, 0, 10));
            vbox.getChildren().addAll(label, table);
    
            ((Group) scene.getRoot()).getChildren().addAll(vbox);
    
            stage.setScene(scene);
            stage.show();
        }
    
        public static class Person {
    
            private final StringProperty firstName;
            private final StringProperty lastName;
            private final StringProperty email;
    
            private Person(String fName, String lName, String email) {
                this.firstName = new SimpleStringProperty(fName);
                this.lastName = new SimpleStringProperty(lName);
                this.email = new SimpleStringProperty(email);
            }
    
            public String getFirstName() {
                return firstName.get();
            }
    
            public void setFirstName(String fName) {
                firstName.set(fName);
            }
    
            public StringProperty firstNameProperty() {
                return firstName ;
            }
    
            public String getLastName() {
                return lastName.get();
            }
    
            public void setLastName(String fName) {
                lastName.set(fName);
            }
    
            public StringProperty lastNameProperty() {
                return lastName ;
            }
    
            public String getEmail() {
                return email.get();
            }
    
            public void setEmail(String fName) {
                email.set(fName);
            }
    
            public StringProperty emailProperty() {
                return email ;
            }
        }
    }
    

    And then the selected line - table.css:

    .table-line-cell: {selected row

    -fx-background-color: lightskyblue;

    }

Maybe you are looking for

  • Clear Bios password

    I have a Compaq CQ62 which has a power on password I forgot the key code is #69558137 Can someone help me please?

  • Several pages not to load not after update - webkit error. Yosemite.

    Do you have a update system today (March, 22.). Several pages in Safari are suddenly empty now and don't be loading not "unexpected." Report of tips for "com.apple.WebKit.WebContent." So what I tried so far: -Disable Plugins -deleted all the cache, h

  • HP M215-IAA16180G01: enter the current password

    I have problem with my current password... Need help please... Thank you

  • Using the camera!

    All too complex for geriatric brain!  I want to transfer photos from camera to the IPad.  Wi - fi, they can "see" each other, but it doesn't seem to be of any medium to copy the photos on the iPad. Is this possible? Y at - it app for download or some

  • Preparing to update my graphics card...

    Hello! Therefore, the current graphics card I have a NVIDIA GeForce 6150SE nForce 430. Since I discovered games with higher graphics standards, I decided I want to get a higher graphics card to replace my current. I was looking at maybe a NVIDIA GeFo