Action myAction= new Action("LABEL", ImageCache.getImageDescriptor("IMAGE"));
This code shows me a button without any text. Instead it only shows the image.
What should I do to display them both side by side?
I tried using setText() and setDescription() and setImageDescriptor() but none helped.
Text is not normally shown for an action in a ToolBar if there is also an image.
If you are adding the Action to the tool bar manager using an ActionContributionItem you can call ActionContributionItem.setMode(ActionContributionItem.MODE_FORCE_TEXT);
Related
I set navigation bar color in my app like this:
getWindow().setNavigationBarColor(ContextCompat
.getColor(MainActivity.this, R.color.my_color));
and after change fragment I want to reset navigation bar color(come back to default). How do this ? I want not set in my style
android:navigationBarColor">#color/my_navigaton_bar_color< and when I want set default, call:
getWindow().setNavigationBarColor(ContextCompat
.getColor(MainActivity.this, R.color.my_navigaton_bar_color));
P.S. I was try save in variable getWindow().getNavigationBarColor() but it always -1 , a also try decode value from android.R.attrs.navigationBarColor but it also doesn't work
This can be done inside styles.xml using
<item name="android:navigationBarColor">#color/theme_color</item>
or
window.setNavigationBarColor(#ColorInt int color)
This image may also help you to indentify which color goes where
You can find details: here and here
I am implementing an editor in Swing. It shows plain text with hyperlinks. The problem statement is that when a user clicks on a hyperlink, a popup menu must appear at the mouse position or just below the hyperlink text. User can select the option from the menu and the text of hyperlink will be updated to the text in the option user selected. Moreover, after selecting the option, the menu disappears.
I am trying it on both jTextPane and jEditor pane. I used hyperlinkUpdate listener to display popup menu, but it always appears at the top left corner of the GUI.
Moreover, I could not find how to update the text of the hyperlink.
Here is the code of hyperlinkUpdate event:
private void jEditorPane1HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {
if(evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED){
System.out.println(evt.getDescription());
jPopupMenu1.setAlignmentX(jEditorPane1.getMousePosition().x);
jPopupMenu1.setAlignmentY(jEditorPane1.getMousePosition().y);
jPopupMenu1.setVisible(true);
}
}
Someone kindly guide me in this matter.
Thanks in advance.
The call should be like this
JPopupMenu popup = new JPopupMenu();
popup.add("Item 1");
popup.add("Item 2");
popup.show(mouseEvent.getComponent(),mouseEvent.getX(),mouseEvent.getY());
See an example here
http://www.experts-exchange.com/Programming/Languages/Java/Q_20143329.html
I have a popup in GWT UI screen, in that popup I have Listbox. My problem is when I try to select any option in the ListBox popup closes itself and all I can see is ListBox dropdown options.
PopupPanel have autoHide function in default.
Use below code to disable autoHide when creating PopupPanel.
PopupPanel myPopUp = new PopupPanel(false);
Use these methods to handle open and close PopupPanel.
myPopUp.show();
myPopUp.hide();
I want to change this filter icon to another one, I have tried this method setFilterButtonProperties(newButton);
but it doesn't work.
here the image which I want to change.
Try this one
Button newButton=new Button("");
newButton.setSize("18px", "18px");
newButton.setIcon("[SKIN]/RecordEditor/add.png");
listGrid.setFilterButtonProperties(newButton);
Note: Change the icon path and size as per your requirement.
How will it be possible to have a menu button which call option-menus with the following condistions ( must be ):
App hides the titlebar :
requestWindowFeature(Window.FEATURE_NO_TITLE);
the targetversion in Manifest is set to 16 :
android:targetSdkVersion="16"
Some Infos and researches from my side:
Setting targetSdkVersion="10" shows the menu still in the bottom, which I would like to achieve.
Showing the titlebar shows the menubutton in top ( 3 points icon ) and the menu is also callable. But I need to hide the titlebar.
any hints , suggestions ?
thanks & regards
Andreas
Another option is to use slider menu and have it on left or right. You shouldn't include button on action bar (like facebook), you can open menu after item click or onFling event.
There is nice and easy tutorial that I tried:
http://oodlestechnologies.com/blogs/Facebook-Style-Slide-Menu-In-Android