Add custom layout to ActionBar with Gravity Left? - android-5.0-lollipop

The ActionBar shows a space on the left side of the custom view.
I want to set my custom view align left of Actionbar.
I'm trying to set
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
and any other method like setLogo(null),But it's not work.
My code is like
ABCMainView actionLayout = new ABCMainView(this); //my custom view
getSupportActionBar().setDisplayShowCustomEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
getSupportActionBar().setCustomView(actionLayout);
My ActionBar is android-appcompat-v21.
How can i do this?

Try with this in your Toolbar xml config
android:contentInsetStart="0dp"
Base on Chris Banes' response https://stackoverflow.com/a/26495926/1568429

Related

Angular Ag-Grid, how to place a material progress spinner inside of the overlayNoRowsTemplate?

I am trying to place a mat-progress-spinner inside of my agGrid when there are no rows to show.
Something like this works:
private overlayNoRowsTemplate = '<p>No rows to show.</p>';
But when I try to add the mat-progress-spinner it doesn't show
private overlayNoRowsTemplate = '<mat-progress-spinner style="margin:0 auto;" mode="indeterminate"></mat-progress-spinner>'
Is what I am trying to do even possible?
https://www.ag-grid.com/javascript-grid-overlays/
Custom Templates
If you're not happy with the provided overlay templates, you can provide your own. This is done with the grid properties
overlayLoadingTemplate and overlayNoRowsTemplate. These templates
should be plain HTML.
However, you can use an Angular component if you use a "custom overlay component" instead:
https://www.ag-grid.com/javascript-grid-overlay-component/
https://www.ag-grid.com/javascript-grid-components/

LibGDX Scroll Pane of buttonGroup

I am trying to create my own tile map creator, so I need some panel where user can choose between textures. I wanted to create scrollpane inside my camera view. It moves perfectly and everything is working with List of Strings but if I want to change Strings to buttonGroup it only displays in my scrollpane "com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup#5dcff25d" nothing else only one row with this. Here is my code:
private void initPanel(){
skin=new Skin(Gdx.files.internal("uiskin.json"));
background = new Group();
background.setBounds(0, CAM_HEIGHT-PANEL_SIZE, PANEL_SIZE, PANEL_SIZE);
stage=new Stage(new ScreenViewport());
list=new List<ButtonGroup>(skin);
buttons=new TextButton[TEXTURE_NUMBER];
buttons[0]=new TextButton("Delete",skin);
buttons[1]=new TextButton("Red",skin);
buttons[2]=new TextButton("Blue",skin);
buttons[3]=new TextButton("Green",skin);
buttonGroup=new ButtonGroup<TextButton>(buttons);
buttonGroup.setMaxCheckCount(1);
buttonGroup.setMinCheckCount(0);
list.setItems(buttonGroup);
scrollPane=new ScrollPane(list);
scrollPane.setBounds(0, 0, PANEL_SIZE, PANEL_SIZE);
scrollPane.setPosition(0,CAM_HEIGHT-PANEL_SIZE);
scrollPane.setTransform(true);
stage.addActor(background);
stage.addActor(scrollPane);
background.addActor(new Image(new Texture("textures/panel_background.png")));
Gdx.input.setInputProcessor(stage);
}
Whenever you see something like com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup#5dcff25d or package.class#hexstring, it means that somebody is trying to convert the object into a string by calling Object#toString().
In this case the culprit is List class- which is designed to take a bunch of objects and display them as text. ButtonGroup is intended to associate the buttons logically instead of position them on the screen, so you'll need to create the ButtonGroup and a Table. Add the buttons to both, and then put the table into the ScrollPane.
I'm assuming of course you need the ButtonGroup functionality to manage the buttons. If the buttons are independent of each other, then you can skip the ButtonGroup entirely and just add the buttons to the table.

Adding content to a div in HTML using GWT

I am pretty new to GWT, and I have these dynamic divs setup on my starting GWT html page:
<div id="nav">
Navigation goes here...
</div>
<div id="core">
</div>
<div id="footer">
footer info goes here
</div>
I have my main class that implements EntryPoint and ValueChangeHandler to dynamically change the "core" div so it renders different information based on what the user clicks on the main page (so it mimicks using different pages, but only using one through History and Hyperlink classes Like this). I tried doing this with something like:
VerticalPanel panel = new VerticalPanel();
HTML mapHtmlDiv = new HTML("<div id=\"maps\"></div>");
panel.add(mapHtmlDiv);
RootPanel.get("core").add(panel);
// add a widget to the maps div downstream
Once the condition is met. However this is not allowed on GWT, as it throws an error along the lines of "A widget that has an existing parent widget may not be added to the detach list", what is the correct way of adding content and divs to HTML?
HTML widget in GWT is not a container. This means you can't add widgets into it. Use HTMLPanel instead.
VerticalPanel panel = new VerticalPanel();
HTMLPanel mapPanel = new HTMLPanel(""); //automatically creates a div.
panel.add(mapPanel);
RootPanel.get("core").add(panel);
// add a widget to the maps div downstream
mapPanel.add(new Label("Sample label"));
http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/HTMLPanel.html
VerticalPanel panel = new VerticalPanel();
HTML mapHtmlDiv = new HTML("<div id=\"maps\"></div>");
panel.add(mapHtmlDiv);
Element coreDiv = DOM.getElementById("core");
coreDiv.appendChild(panel.getElement());

how to implement tab in the navigation title?

I want to add tabs in the navigation title like below. Anyone could tell me the method to implement this.
I use swift2 and IOS9.
You can set any kind of UIView object to your navigationItem as a titleView
self.navigationItem.titleView = segmentedControl;
here segmentedControl maybe UISegmentedControl object.

JTabbedPane tab-alignment

I can't seem to find this.
What method (and constant) do I use to align the tabs in a JTabbedPane.
I Found how to switch between Top and Bottom. But I'm trying to put them in the center at the bottom.
So that it looks like this
ooooooooooooooooooo
o..................................o
o..................................o
o..................................o
o..................................o
ooooooooooooooooooo
...... |Tab1||Tab2|
Thanks
You can't. This layout rule is enforced by the selected look and feel.
You can write your own UI-Delegate for JTabbedPane component that extends BasicTabbedPane class and overwrite the
method 'getTabInsets(int, int)'. Change value of 'tabInsets' atribute ( default value is: new Insets(0,4,1,4), centered).