antoniolg / MaterialEverywhere

Showcase of the new AppCompat 21, which includes new Material Theme, working in pre-21 devices.
1.29k stars 306 forks source link

A few questions about the toolbar... #2

Closed AndroidDeveloperLB closed 9 years ago

AndroidDeveloperLB commented 10 years ago

I have a few questions regarding the toolbar (which acts as an actionbar) :

  1. How would you add the cool animations of the "up" button when being clicked?
  2. How would you make the navigation drawer to avoid being on top of the action bar ?
  3. How would you put it in PreferenceActivity (for pre-API11 versions), if you can't extend from PreferenceActivity (as you must extend from ActionBarActivity) ? You can't even use PreferenceFragment, as it's from API 11 and above... ?

Please help.

AndroidDeveloperLB commented 10 years ago

About #2, that was actually quite easy. I just changed the layout file of "activity_home.xml" to this:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <include
            android:id="@+id/toolbar"
            layout="@layout/toolbar" />

        <android.support.v4.widget.DrawerLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:id="@+id/drawer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:context=".HomeActivity" >

            <GridView
                android:id="@+id/gridView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipToPadding="false"
                android:columnWidth="@dimen/item_width"
                android:horizontalSpacing="4dp"
                android:numColumns="auto_fit"
                android:padding="4dp"
                android:stretchMode="columnWidth"
                android:verticalSpacing="4dp" />

            <ListView
                android:layout_width="260dp"
                android:layout_height="match_parent"
                android:layout_gravity="start"
                android:background="@color/windowBackgroundColor" />
        </android.support.v4.widget.DrawerLayout>

    </LinearLayout>
antoniolg commented 9 years ago

How would you add the cool animations of the "up" button when being clicked?

You can achieve it using the new ActionBarDrawerToggle (https://developer.android.com/reference/android/support/v7/app/ActionBarDrawerToggle.html)

How would you put it in PreferenceActivity (for pre-API11 versions)

I don't know of a way for previous versions. Maybe look for a supported PreferenceFragment out there.

AndroidDeveloperLB commented 9 years ago

About the "up" animations, correct. about the PreferecenActivity, I've made a library if you wish: https://github.com/AndroidDeveloperLB/MaterialStuffLibrary

On Sun, Oct 26, 2014 at 10:32 AM, Antonio Leiva notifications@github.com wrote:

How would you add the cool animations of the "up" button when being clicked?

You can achieve it using the new ActionBarDrawerToggle ( https://developer.android.com/reference/android/support/v7/app/ActionBarDrawerToggle.html )

How would you put it in PreferenceActivity (for pre-API11 versions)

I don't know of a way for previous versions. Maybe look for a supported PreferenceFragment out there.

— Reply to this email directly or view it on GitHub https://github.com/antoniolg/MaterialEverywhere/issues/2#issuecomment-60510172 .