android-toolbar

android toolbar: how to have a toolbar with image in the background and menu items on top

女生的网名这么多〃 提交于 2019-12-05 01:00:29
Using material design how to create a toolbar with background image. the following is what i want: I am trying the following code: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/actionBar" android:layout_width="match_parent" android:layout_height="200dp" app:contentInsetEnd="0dp" app:contentInsetStart="0dp" android:minHeight="200dp"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id

Android toolbar change layout

▼魔方 西西 提交于 2019-12-05 00:11:16
问题 I got an activity with many fragments. When i change fragments i need to change also and my toolbar declared in MainActivity.class . My problem is that i include a layout and didnt find a method to change this layout. How to change toolbars layout in this case? MainActivity.class @ContentView(R.layout.activity_main) public class MainActivity extends RoboActionBarActivity { @InjectView(R.id.tool_bar) Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate

How to have an image with a dynamic text in it, all in a drawable, like the “today” action item on Google Calendar app?

ε祈祈猫儿з 提交于 2019-12-04 23:46:10
Background Google Calendar app has an action item that dynamically change according to the current day ("today"): I'm required to do a very similar thing, but with a slightly different image that surrounds the text. The problem I did succeed to make it work, by creating a Drawable that has text and image in it (based on here ). However, I'm don't think I did it well enough : Text font might be different across devices, so might not fit well in what I wrote. Not sure if it's because of the VectorDrawable or the text, but I think the text doesn't seem so centered . Seems a bit to the left. This

How to make SearchView that covers the entire ActionBar/Toolbar

梦想的初衷 提交于 2019-12-04 20:52:37
How does one create this? If you try using a Toolbar and you have inflated MenuItems you'll quickly find out that your Toolbar layout will shrink in width so it does not overlay the MenuItems. The only thing that comes to mind is inflating a layout and adding it to the Window as an overlay that sits on top of the ActionBar. Remember, this is not a problem if you do not need to inflate MenuItems in your Toolbar/ActionBar as then you are given the full width to occupy. So I went with the route of adding my view as an overlay. /** * A Material themed search view that should be overlayed on the

How to set space on left&right of the logo in the actionBar ?

自闭症网瘾萝莉.ら 提交于 2019-12-04 20:03:22
Background I want to show a bitmap on the left side of the title of the activity, in the actionbar (toolbar, to be exact), so I used this: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setLogo(R.mipmap.ic_launcher); ... The problem Thing is, the logo seems to have too much margin on its left, while the title text is very near the logo itself, so it looks like this: This is not symmetrical at all.

How to set the color of icon in Android toolbar?

梦想与她 提交于 2019-12-04 19:45:29
I forked a GitHub project from https://github.com/nglauber/playground/tree/master/android/DemoSearch I would like to set the color of the search icon to be pure white. At the moment, the search icon is gray in color, and is obviously different from the white text of "Demo Search". Edit: Based on some suggestions, I created a new icon using pure white (to be exact, RGB=255,255,255), and use it in place of the android:ic_menu_search. Android will tint it with a gray tone (verified with color picker tool on the screenshot), even though the original icon is in pure white. This suggests to me that

Contextual action bar does not overlay my toolbar

北城以北 提交于 2019-12-04 17:51:37
问题 I have created an activity and set toolbar as the actionbar which i have positioned at the bottom. Inside that activity, I have a listview that contain some data. Problem is, when I long press a list item, contextual action bar appears at the top instead of overlaying my toolbar which is positioned at the bottom. my activity theme <?xml version="1.0" encoding="utf-8"?> <resources> <!-- Base application theme. --> <style name="myActivityTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item

Toolbar title is not centered

懵懂的女人 提交于 2019-12-04 15:15:36
I added a Toolbar in my app. For that I am using the below xml code for custom toolbar layout. Toolbar.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#212E42" android:minHeight="?attr/actionBarSize"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <RelativeLayout android:id="@+id/lefttoolbarContainer" android:layout_width="match_parent" android

How to recreate Android quick settings sliding panel?

余生长醉 提交于 2019-12-04 14:07:15
问题 In my app I want to recreate something that is very similar to the Lollipop+ quick settings panel that everyone knows. That is: by clicking or dragging the header, I want a panel to slide down from below the header and push down the existing content . Applied to my app now, the header is a Toolbar and the main content is a RecyclerView showing a list of blog posts. By clicking or dragging the Toolbar, I'd like a panel to appear to show some stats about the blog. Like so: I have been messing

Toolbar button gravity for extended toolbar

丶灬走出姿态 提交于 2019-12-04 13:42:36
问题 Im trying to set the position of my back navigation icon in my extended toolbar as follows: <android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbar" android:layout_height="wrap_content" android:layout_width="match_parent" app:theme="@style/Toolbar" android:minHeight="@dimen/action_bar_height" app:buttonGravity="top" android:gravity="top" android:background="?attr/colorPrimary" />