0

In my App i have a ToolBar as ActionBar at the top and a standalone ToolBar at the bottom. The bottom ToolBar displays two links and the action menu to the right but leaves a large space on the left, presumably for the application image and title. I would like to use this space for more links. I have not been able to find a way to do this. I found these padding options but they did not effect any change ...

    android:contentInsetStart="0dp"
    android:contentInsetLeft="0dp"
    app:contentInsetLeft="0dp"
    app:contentInsetStart="0dp"

Here is the xml for the ToolBar

    android:id="@+id/toolbarbottom"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/darker_gray"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" >

</android.support.v7.widget.Toolbar>

Here is the java code ...

    Toolbar toolbarBottom = (Toolbar) findViewById(R.id.toolbarbottom);
    toolbarBottom.inflateMenu(R.menu.mainbottom);
    toolbarBottom.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
                case R.id.webview:               // Web View
                    BrowseWWW();
                    return true;

                case R.id.jsoupview:             // Jsoup View
                    LoadHTMLJsoup();
                    return true;

                case R.id.codeview:               // Code View
                    LoadHTMLCode();
                    return true;

                case R.id.connview:              // Connectivity View
                    GetHTMLConn();
                    return true;

                case R.id.ftpview:               // Ftp View
                    GetHTMLFtp();
                    return true;
            }
            return true;
        }
    });

And the menu ...

<item android:id="@+id/webview"
    android:title="@string/webview"
    HTMLSpyII:showAsAction="always|withText" />

<item android:id="@+id/jsoupview"
    android:title="@string/jsoupview"
    HTMLSpyII:showAsAction="always|withText" />

<item android:id="@+id/codeview"
    android:title="@string/codeview"
    HTMLSpyII:showAsAction="ifRoom|withText" />

<item android:id="@+id/connview"
    android:title="@string/Connectivity"
    HTMLSpyII:showAsAction="ifRoom|withText" />

<item android:id="@+id/ftpview"
    android:title="@string/ftpview"
    HTMLSpyII:showAsAction="ifRoom|withText" />

Mick
  • 663
  • 1
  • 9
  • 18

1 Answers1

0

You should be able to inflate your own layout and set it on the toolbar. Something like this:

LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.custom_layout, null);
mToolbar.addView(view);
Chris Thoma
  • 499
  • 2
  • 8
  • 1
    I found this which has exactly what i need ... http://stackoverflow.com/questions/29807744/how-can-i-align-android-toolbar-menu-icons-to-the-left-like-in-google-maps-app – Mick Aug 27 '15 at 15:27