android-toolbar

Android Lollipop Toolbar vs Custom view

强颜欢笑 提交于 2019-12-02 20:40:42
I just read about the new Toolbar in Android Lollipop. It inherits from ViewGroup. Why are the advantages of using the new Toolbar over, say, a LinearLayout to place your own views? Explanation: You should start using a ToolBar instead of the ActionBar . This is directly taken from the Android Developer documentation. It allows more flexibility than the normal ActionBar ; however, retains some the more prominent features such as adding a Logo , supports "up" Navigation , inflating menus and actionviews such as the SearchView. Tutorials: Implement yourself(by Chris Banes) Collapsing Toolbar,

How to put RecyclerView below Toolbar and above TabLayout and ViewPager also handling responses to scrolls in a custom manner?

会有一股神秘感。 提交于 2019-12-02 20:39:54
I want to create a layout like the below image: A CoordinatorLayout which contain : CollapsingToolbarLayout( contain ImageView & Toolbar) RecyclerView TabLayout ViewPager( that each fragment of it contain a RecyclerView) I wanna responding to scroll events in this way: CollapsingToolbarLayout expand and collapse by scrolling Toolbar sticks to the top until TabLayout reach to the top After that toolbar scroll up and TabLayout stick to the top I'm having trouble with the RecyclerView between CollapsingToolbarLayout and TabLayout. I can implement this layout without that RecyclerView( I put

android.view.View$OnUnhandledKeyEventListener

柔情痞子 提交于 2019-12-02 20:09:40
I am new to Android Studio and I don't get why my toolbar isn't shown as described by https://developer.android.com/training/appbar/setting-up I know there are already some other questions like mine on stackoverflow but they don't work at my project. Therefore I would be very thankful for fixing this issue. Screenshot: java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener at org.jetbrains.android.uipreview.ModuleClassLoader.load(ModuleClassLoader.java:180) at com.android.tools.idea.rendering.RenderClassLoader.findClass(RenderClassLoader.java:61) at org.jetbrains

Use Toolbar across all activities (Android)

时间秒杀一切 提交于 2019-12-02 17:59:16
I'm using a Toolbar to replace the ActionBar. All is going well with one problem: The toolbar shows only on the main activity. If I try call the toolbar on any activity the same way I did with the main activity the app will crash when I call that activity. If I try to inflate the toolbar onCreateOptionsMenu, that activity will crash when I call it. How can I call/use the same toolbar across all my activities and not just the main one. here is some pieces of the code: public android.support.v7.widget.Toolbar toolbar; protected void onCreate(Bundle savedInstanceState) { super.onCreate

Change title color in toolbar?

不问归期 提交于 2019-12-02 17:30:14
I have a toolbar that I use, and set title with: ((ActionBarActivity)getActivity()).getSupportActionBar().setTitle("Home"); Is there a way to change the color from black to white? I tried making its own theme and setting it in the xml like this, but no dice: <resources> <!-- Base application theme. --> <style name="AppTheme2" parent="Theme.AppCompat"> <item name="android:windowNoTitle">true</item> <item name="windowActionBar">false</item> <item name="colorPrimary">@color/primary</item> <item name="colorPrimaryDark">@color/primary_dark</item> <item name="colorAccent">@color/accent</item> <item

Android Toolbar and User Image Animation Like Twitter

℡╲_俬逩灬. 提交于 2019-12-02 17:15:33
I'm trying to achieve the toolbar and User image animation like the one that is used in Twitter's user profile. I tried a lot of things but I cannot achieve pinning the collapsed toolbar at the top of the screen quickly with the some background it had when it was expanded and making the User Image be first above the toolbar and then make a scale down and move below the toolbar while scrolling. How does twitter make the smooth effect in the User Profile image? How they first have this image in front of the toolbar and then while scrolling goes behind and achieve that smooth effect going below

CoordinatorLayout: Hiding/Showing half visible toolbar?

爱⌒轻易说出口 提交于 2019-12-02 16:52:42
Id like to achieve a similar effect as the one you can see in Google Play store , where by scrolling the content the Toolbar goes off-screen as you scroll. This works fine with the CoordinatorLayout ( 1 ) introduced at #io15 , however: If you stop the scroll "mid-way" the Toolbar remains on screen, but is cut in half: I want it to animate off-screen, just like in the Google Play store. How can I achieve that? Now the Android Support Library 23.1.0 has a new scroll flag SCROLL_FLAG_SNAP which allows you to achieve this effect. AppBarLayout supports a number of scroll flags which affect how

Inflating AppBarLayout with Toolbar + TabLayout

北慕城南 提交于 2019-12-02 16:18:29
I currently have a DrawerLayout in my main.xml. There's a Toolbar wrapped in an AppBarLayout, and then a simple LinearLayout to swap out fragments. One of the fragments I navigate to, I want it to contain a TabLayout for a ViewPager of fragments. Currently, I have both of these in the fragment's layout file, but this causes a drop shadow to appear between the Toolbar and the TabLayout, which is something I don't want. I also don't want to use setElevation() because it won't work for pre-Lollipop devices. A possible solution would be to inflate the AppBarLayout from my fragment, so that it

Toolbar custom view cannot clickable

半城伤御伤魂 提交于 2019-12-02 15:42:43
问题 I need your help!!! I'm in progress to this post. I have a layout_header <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@drawable/bg_shadow_blue"> <com.andexert.library.RippleView android:id="@+id/rippleLeft" style="@style/ripple" android:layout_alignParentLeft="true" android:layout_centerVertical="true" app:rv_type

Add badge counter to hamburger navigation menu icon in Android

大兔子大兔子 提交于 2019-12-02 15:17:21
My question is the same as this question (which is not a duplicate of this question ). The only answer to that question does not work for me as, rather than changing the default hamburger icon to the left of the activity's title, it just adds an additional hamburger icon to the right of my activity's title. So how do I actually get this: I've been poking around at it all day, but have got nowhere. I see that Toolbar has a setNavigationIcon(Drawable drawable) method. Ideally, I would like to use a layout (that contains the hamburger icon and the badge view) instead of a Drawable , but I'm not