如何与 NavigationDrawer 一起滑动 ActionBar [英] How to slide the ActionBar along with the NavigationDrawer
问题描述
我想要做的是在打开抽屉时将 ActionBar
与 NavigationDrawer
一起滑动.我目前没有使用任何第三方库,如果可能的话,我想保持这种方式.我只需要一个方法的实现,如:getActionBarView.slide(dp);
What I want to do is slide the ActionBar
along with the NavigationDrawer
when the drawer is opened. I am currently not using any third party libraries and if at all possible I want to keep it that way. All i need is an implementation of method like: getActionBarView.slide(dp);
这是我目前用来创建NavigationDrawer
的代码:
This is the code I currently use to create the NavigationDrawer
:
mDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) {
public void onDrawerClosed(View view) {
invalidateOptionsMenu();
// calling onPrepareOptionsMenu() to hide action bar icons
}
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
if (getDeviceType(getApplicationContext()) == DEVICE_TYPE_PHONE) {
drawerLayout.setScrimColor(Color.parseColor("#00FFFFFF"));
float moveFactor = (listView.getWidth() * slideOffset);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
all_menu_container_parent.setTranslationX(moveFactor);
} else {
TranslateAnimation anim = new TranslateAnimation(lastTranslate, moveFactor, 0.0f, 0.0f);
anim.setDuration(0);
anim.setFillAfter(true);
all_menu_container_parent.startAnimation(anim);
lastTranslate = moveFactor;
}
}
}
public void onDrawerOpened(View drawerView) {
// calling onPrepareOptionsMenu() to hide action bar icons
}
};
drawerLayout.setDrawerListener(mDrawerToggle);
但它没有做我想要的,它产生了这个:
But it doesn't do what I want, it produces this:
我想要实现的是:
推荐答案
请注意:这个答案最初是在 Android 4.4 (KitKat) 还很新的时候写的.从 Android 5.0 开始,尤其是由于
ToolBar
的引入,这个答案不能被认为是最新的了!但从技术角度和对于那些想了解 Android 内部工作原理的人这个答案可能仍然很有价值!
PLEASE NOTE: This answer was originally written when Android 4.4 (KitKat) was still pretty new. Since Android 5.0 and especially because of the introduction of the
ToolBar
this answer cannot be considered up-to-date anymore! But from a technical perspective and for those of you who want to learn about the inner workings of Android this answer might still hold a lot of value!
NavigationDrawer
专门设计为位于 ActionBar
下方,并且无法实现 NavigationDrawer
来制作 ActionBar
随之移动 - 除非可能寻找组成 ActionBar
的 View
并将其与 NavigationDrawer
一起动画,但我永远不会推荐这样的东西,因为它很困难且容易出错.在我看来,您只有两种选择:
The NavigationDrawer
was specifically designed to be situated below the ActionBar
and there is no way to implement the NavigationDrawer
to make the ActionBar
move with it - unless maybe looking for the View
which makes up the ActionBar
and animating it alongside the NavigationDrawer
, but I would never recommend something like this as it would be difficult and error prone. In my opinion you only have two options:
- 使用 像 SlidingMenu 一样的库
- 实现自定义滑动菜单
既然你说你不想使用实现自定义滑动菜单的库是你唯一的选择,幸运的是,一旦你知道如何去做,这真的不是那么难.
Since you said that you don't want to use a library implementing a custom sliding menu is your only option, fortunately this is really not that hard once you know how to do it.
您可以移动 Activity
的全部内容 - 我的意思是包括 ActionBar
在内的所有内容 - 通过在 View
上放置边距或填充> 组成 Activity
.这个 View
是 View
的父元素,id 为 android.R.id.content
:
You can move the whole content of the Activity
- I mean everything including the ActionBar
- by putting a margin or a padding on the View
which makes up the Activity
. This View
is the parent of the View
with the id android.R.id.content
:
View content = (View) activity.findViewById(android.R.id.content).getParent();
在 Honeycomb(Android 3.0 版 - API 级别 11)或更高版本上 - 换句话说,在引入 ActionBar
之后 - 您需要使用边距来更改 Activities
位置在以前的版本中,您需要使用填充.为了简化这一点,我建议创建辅助方法,为每个 API 级别执行正确的操作.我们先来看看如何设置Activity
的位置:
On Honeycomb (Android version 3.0 - API level 11) or above - in other words after the ActionBar
was introduced - you need to use margins to change the Activities
position and on previous versions you need to use a padding. To simplify this I recommend creating helper methods which perform the correct action for each API level. Let's first look at how to set the position of the Activity
:
public void setActivityPosition(int x, int y) {
// With this if statement we can check if the devices API level is above Honeycomb or below
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// On Honeycomb or abvoe we set a margin
FrameLayout.LayoutParams contentParams = (FrameLayout.LayoutParams) this.content.getLayoutParams();
contentParams.setMargins(x, y, -x, -y);
this.content.setLayoutParams(contentParams);
} else {
// And on devices below Honeycomb we set a padding
this.content.setPadding(x, y, -x, -y);
}
}
请注意,在这两种情况下,两侧都有负边距或负填充.这实质上是将 Activity
的大小增加到超出其正常范围.这可以防止 Activity
的实际大小在我们将其滑动到某处时发生变化.
Notice that in both cases there is either a negative margin or a negative padding on the opposite sides. This is to essentially increase the size of the Activity
beyond its normal bounds. This prevents the actual size of the Activity
to change when we slide it somewhere.
我们还需要两个方法来获取Activity
的当前位置.一个用于 x 位置,一个用于 y 位置:
We additionally need two methods to get the current position of the Activity
. One for the x position, one for the y position:
public int getActivityPositionX() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// On Honeycomb or above we return the left margin
FrameLayout.LayoutParams contentParams = (FrameLayout.LayoutParams) this.content.getLayoutParams();
return contentParams.leftMargin;
} else {
// On devices below Honeycomb we return the left padding
return this.content.getPaddingLeft();
}
}
public int getActivityPositionY() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// On Honeycomb or above we return the top margin
FrameLayout.LayoutParams contentParams = (FrameLayout.LayoutParams) this.content.getLayoutParams();
return contentParams.topMargin;
} else {
// On devices below Honeycomb we return the top padding
return this.content.getPaddingTop();
}
}
添加动画也很简单.这里唯一重要的是一些数学计算,将它从以前的位置动画到新位置
It is also very simple to add animations. The only important thing here is a bit of math to animate it from its previous position to its new position
// We get the current position of the Activity
final int currentX = getActivityPositionX();
final int currentY = getActivityPositionY();
// The new position is set
setActivityPosition(x, y);
// We animate the Activity to slide from its previous position to its new position
TranslateAnimation animation = new TranslateAnimation(currentX - x, 0, currentY - y, 0);
animation.setDuration(500);
this.content.startAnimation(animation);
您可以在将 Activity
添加到 View
的父级后,在显示的位置显示 View
:
You can display a View
at the location which is revealed by sliding away the Activity
by adding it to the parent of the View
:
final int currentX = getActivityPositionX();
FrameLayout menuContainer = new FrameLayout(context);
// The width of the menu is equal to the x position of the `Activity`
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(currentX, ViewGroup.LayoutParams.MATCH_PARENT);
menuContainer.setLayoutParams(params);
ViewGroup parent = (ViewGroup) content.getParent();
parent.addView(menuContainer);
这几乎就是您创建一个基本的滑动菜单所需的全部内容,该菜单适用于 Eclair(Android 2.1 - API 级别 7)以上的大多数设备(如果不是所有设备).
And that is pretty much all you need to create a basic sliding menu that works on most if not all devices above Eclair (Android 2.1 - API level 7).
创建滑动菜单的第一部分是让 Activity
移开.因此,我们应该首先尝试像这样移动 Activity
:
The first part of creating a sliding menu is making the Activity
move out of the way. As such we should first try to move the Activity
around like this:
要创建这个,我们只需要把上面的代码放在一起:
To create this we just have to put the code above together:
import android.os.Build;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout;
public class ActivitySlider {
private final FragmentActivity activity;
private final View content;
public ActivitySlider(FragmentActivity activity) {
this.activity = activity;
// Here we get the content View from the Activity.
this.content = (View) activity.findViewById(android.R.id.content).getParent();
}
public void slideTo(int x, int y) {
// We get the current position of the Activity
final int currentX = getActivityPositionX();
final int currentY = getActivityPositionY();
// The new position is set
setActivityPosition(x, y);
// We animate the Activity to slide from its previous position to its new position
TranslateAnimation animation = new TranslateAnimation(currentX - x, 0, currentY - y, 0);
animation.setDuration(500);
this.content.startAnimation(animation);
}
public void setActivityPosition(int x, int y) {
// With this if statement we can check if the devices API level is above Honeycomb or below
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// On Honeycomb or above we set a margin
FrameLayout.LayoutParams contentParams = (FrameLayout.LayoutParams) this.content.getLayoutParams();
contentParams.setMargins(x, y, -x, -y);
this.content.setLayoutParams(contentParams);
} else {
// And on devices below Honeycomb we set a padding
this.content.setPadding(x, y, -x, -y);
}
}
public int getActivityPositionX() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// On Honeycomb or above we return the left margin
FrameLayout.LayoutParams contentParams = (FrameLayout.LayoutParams) this.content.getLayoutParams();
return contentParams.leftMargin;
} else {
// On devices below Honeycomb we return the left padding
return this.content.getPaddingLeft();
}
}
public int getActivityPositionY() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// On Honeycomb or above we return the top margin
FrameLayout.LayoutParams contentParams = (FrameLayout.LayoutParams) this.content.getLayoutParams();
return contentParams.topMargin;
} else {
// On devices below Honeycomb we return the top padding
return this.content.getPaddingTop();
}
}
}
您可以像这样使用 ActivitySlider
类:
You can use the ActivitySlider
class like this:
ActivitySlider slider = new ActivitySlider(activity);
// This would move the Activity 400 pixel to the right and 100 pixel down
slider.slideTo(400, 100);
<小时>
3) 添加滑动菜单
现在我们想要在 Activity
像这样移开时显示一个菜单:
如您所见,它还将 ActionBar
推到一边.
3) Adding the sliding menu
Now we want to reveal a menu when the Activity
moves out of the way like this:
As you can see it also pushes the ActionBar
to the side.
ActivitySlider
类不需要修改那么多来创建滑动菜单,基本上我们只需要添加两个方法,showMenu()
和 hideMenu()
.我将坚持最佳实践并使用 Fragment
作为滑动菜单.我们需要的第一件事是一个 View
- 例如一个 FrameLayout
- 作为我们的 Fragment
的容器.我们需要把这个View
添加到Activity
的View
的父级:
The ActivitySlider
class does not need to be modified that much to create a sliding menu, basically we just add two methods, showMenu()
and hideMenu()
. I will stick to best practices and use a Fragment
as the sliding menu. The first thing we need need is a View
- for example a FrameLayout
- as a container for our Fragment
. We need to add this View
to the parent of the View
of the Activity
:
// We get the View of the Activity
View content = (View) activity.findViewById(android.R.id.content).getParent();
// And its parent
ViewGroup parent = (ViewGroup) content.getParent();
// The container for the menu Fragment is a FrameLayout
// We set an id so we can perform FragmentTransactions later on
FrameLayout menuContainer = new FrameLayout(this.activity);
menuContainer.setId(R.id.flMenuContainer);
// The visibility is set to GONE because the menu is initially hidden
menuContainer.setVisibility(View.GONE);
// The container for the menu Fragment is added to the parent
parent.addView(menuContainer);
由于我们将容器View
的可见性设置为VISIBLE,只有在滑动菜单实际打开时,我们可以使用以下方法来检查菜单是打开还是关闭:
Since we set the visibility of the container View
to VISIBLE only when the sliding menu is actually open we can use the following method to check if the menu is open or closed:
public boolean isMenuVisible() {
return this.menuContainer.getVisibility() == View.VISIBLE;
}
为了设置菜单Fragment
,我们添加了一个执行FragmentTransaction
的setter方法并将菜单Fragment
添加到FrameLayout代码>:
To set the menu Fragment
we add a setter method that performs a FragmentTransaction
and adds the menu Fragment
to the FrameLayout
:
public void setMenuFragment(Fragment fragment) {
FragmentManager manager = this.activity.getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.flMenuContainer, fragment);
transaction.commit();
}
为了方便起见,我还倾向于添加第二个 setter,它从 Class
实例化 Fragment
:
I also tend to add a second setter which instantiates the Fragment
from a Class
for convenience:
public <T extends Fragment> void setMenuFragment(Class<T> cls) {
Fragment fragment = Fragment.instantiate(this.activity, cls.getName());
setMenuFragment(fragment);
}
当涉及到菜单 Fragment
时,还有一件重要的事情需要考虑.我们在 View
层次结构中的操作比平时要高得多.因此,我们必须考虑状态栏的高度等因素.如果我们不考虑这一点,菜单顶部 Fragment
会隐藏在状态栏后面.您可以像这样获取状态栏的高度:
There is one additional important thing to consider when it comes to the menu Fragment
. We are operating much further up in the View
hierarchy than normally. As such we have to take things like the height of the status bar into account. If we didn't account for this the top of the menu Fragment
would we be hidden behind the status bar. You can get the height of the status bar like this:
Rect rectangle = new Rect();
Window window = this.activity.getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(rectangle);
final int statusBarHeight = rectangle.top;
我们必须像这样在菜单Fragment
的容器View
上放置一个顶部边距:
We have to put a top margin on the container View
of the menu Fragment
like this:
// These are the LayoutParams for the menu Fragment
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(width, ViewGroup.LayoutParams.MATCH_PARENT);
// We put a top margin on the menu Fragment container which is equal to the status bar height
params.setMargins(0, statusBarHeight, 0, 0);
menuContainer.setLayoutParams(fragmentParams);
最后我们可以将所有这些放在一起:
Finally we can put all this together:
import android.graphics.Rect;
import android.os.Build;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout;
import at.test.app.R;
import at.test.app.helper.LayoutHelper;
public class ActivitySlider {
private final FragmentActivity activity;
private final View content;
private final FrameLayout menuContainer;
public ActivitySlider(FragmentActivity activity) {
this.activity = activity;
// We get the View of the Activity
this.content = (View) activity.findViewById(android.R.id.content).getParent();
// And its parent
ViewGroup parent = (ViewGroup) this.content.getParent();
// The container for the menu Fragment is added to the parent. We set an id so we can perform FragmentTransactions later on
this.menuContainer = new FrameLayout(this.activity);
this.menuContainer.setId(R.id.flMenuContainer);
// We set visibility to GONE because the menu is initially hidden
this.menuContainer.setVisibility(View.GONE);
parent.addView(this.menuContainer);
}
public <T extends Fragment> void setMenuFragment(Class<T> cls) {
Fragment fragment = Fragment.instantiate(this.activity, cls.getName());
setMenuFragment(fragment);
}
public void setMenuFragment(Fragment fragment) {
FragmentManager manager = this.activity.getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.flMenuContainer, fragment);
transaction.commit();
}
public boolean isMenuVisible() {
return this.menuContainer.getVisibility() == View.VISIBLE;
}
// We pass the width of the menu in dip to showMenu()
public void showMenu(int dpWidth) {
// We convert the width from dip into pixels
final int menuWidth = LayoutHelper.dpToPixel(this.activity, dpWidth);
// We move the Activity out of the way
slideTo(menuWidth, 0);
// We have to take the height of the status bar at the top into account!
Rect rectangle = new Rect();
Window window = this.activity.getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(rectangle);
final int statusBarHeight = rectangle.top;
// These are the LayoutParams for the menu Fragment
FrameLayout.LayoutParams fragmentParams = new FrameLayout.LayoutParams(menuWidth, ViewGroup.LayoutParams.MATCH_PARENT);
// We put a top margin on the menu Fragment container which is equal to the status bar height
fragmentParams.setMargins(0, statusBarHeight, 0, 0);
this.menuContainer.setLayoutParams(fragmentParams);
// Perform the animation only if the menu is not visible
if(!isMenuVisible()) {
// Visibility of the menu container View is set to VISIBLE
this.menuContainer.setVisibility(View.VISIBLE);
// The menu slides in from the right
TranslateAnimation animation = new TranslateAnimation(-menuWidth, 0, 0, 0);
animation.setDuration(500);
this.menuContainer.startAnimation(animation);
}
}
public void hideMenu() {
// We can only hide the menu if it is visible
if(isMenuVisible()) {
// We slide the Activity back to its original position
slideTo(0, 0);
// We need the width of the menu to properly animate it
final int menuWidth = this.menuContainer.getWidth();
// Now we need an extra animation for the menu fragment container
TranslateAnimation menuAnimation = new TranslateAnimation(0, -menuWidth, 0, 0);
menuAnimation.setDuration(500);
menuAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
// As soon as the hide animation is finished we set the visibility of the fragment container back to GONE
menuContainer.setVisibility(View.GONE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
this.menuContainer.startAnimation(menuAnimation);
}
}
public void slideTo(int x, int y) {
// We get the current position of the Activity
final int currentX = getActivityPositionX();
final int currentY = getActivityPositionY();
// The new position is set
setActivityPosition(x, y);
// We animate the Activity to slide from its previous position to its new position
TranslateAnimation animation = new TranslateAnimation(currentX - x, 0, currentY - y, 0);
animation.setDuration(500);
this.content.startAnimation(animation);
}
public void setActivityPosition(int x, int y) {
// With this if statement we can check if the devices API level is above Honeycomb or below
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// On Honeycomb or above we set a margin
FrameLayout.LayoutParams contentParams = (FrameLayout.LayoutParams) this.content.getLayoutParams();
contentParams.setMargins(x, y, -x, -y);
this.content.setLayoutParams(contentParams);
} else {
// And on devices below Honeycomb we set a padding
this.content.setPadding(x, y, -x, -y);
}
}
public int getActivityPositionX() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// On Honeycomb or above we return the left margin
FrameLayout.LayoutParams contentParams = (FrameLayout.LayoutParams) this.content.getLayoutParams();
return contentParams.leftMargin;
} else {
// On devices below Honeycomb we return the left padding
return this.content.getPaddingLeft();
}
}
public int getActivityPositionY() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// On Honeycomb or above we return the top margin
FrameLayout.LayoutParams contentParams = (FrameLayout.LayoutParams) this.content.getLayoutParams();
return contentParams.topMargin;
} else {
// On devices below Honeycomb we return the top padding
return this.content.getPaddingTop();
}
}
}
我在 showMenu()
中使用静态辅助方法将倾角转换为像素.下面是这个方法的代码:
I use a static helper method in showMenu()
to convert dip to pixels. Here is the code of this method:
public static int dpToPixel(Context context, int dp) {
float scale = getDisplayDensityFactor(context);
return (int) (dp * scale + 0.5f);
}
private static float getDisplayDensityFactor(Context context) {
if (context != null) {
Resources res = context.getResources();
if (res != null) {
DisplayMetrics metrics = res.getDisplayMetrics();
if(metrics != null) {
return metrics.density;
}
}
}
return 1.0f;
}
您可以像这样使用这个新版本的 ActivitySlider
类:
You can use this new version of the ActivitySlider
class like this:
ActivitySlider slider = new ActivitySlider(activity);
slider.setMenuFragment(MenuFragment.class);
// The menu is shown with a width of 200 dip
slider.showMenu(200);
...
// Hide the menu again
slider.hideMenu();
<小时>
4) 结论 &测试
当您知道可以简单地在 Activity
的 View
上放置边距或内边距时,做这样的事情非常容易.但困难在于让它在许多不同的设备上工作.实现可以跨多个 API 级别发生很大变化,这可能对其行为方式产生相当大的影响.话虽如此,我在这里发布的任何代码都可以在 Eclair(Android 2.1 - API 级别 7)以上的大多数设备上运行,没有任何问题.
当然,我贴在这里的解决方案并不完整,可能需要额外的打磨和清理,所以请随时改进代码以满足您的需求!
4) Conclusion & Testing
Doing something like this is surprisingly easy when you know that you can simply put a margin or a padding on the View
of the Activity
. But the difficulty is in making it work on a lot of different devices. Implementations can change a lot across multiple API Levels and that can have considerable influence on how this behaves. Having said that any code I posted here should work on most if not all devices above Eclair (Android 2.1 - API level 7) without any problems.
Of course the solution I posted here is not complete, it could use a little extra polishing and cleaning up, so feel free to improve the code to suit your needs!
我已在以下设备上测试了所有内容:
I have tested everything on the following devices:
宏达
- 一台 M8(Android 4.4.2 - KitKat):工作
- Sensation(Android 4.0.3 - Ice Cream Sandwich):工作
- 欲望(Android 2.3.3 - Gingerbread):工作
- 一个(Android 4.4.2 - KitKat):工作
- One M8 (Android 4.4.2 - KitKat): Working
- Sensation (Android 4.0.3 - Ice Cream Sandwich): Working
- Desire (Android 2.3.3 - Gingerbread): Working
- One (Android 4.4.2 - KitKat): Working
三星
- Galaxy S3 Mini(Android 4.1.2 - Jelly Bean):工作
- Galaxy S4 Mini(Android 4.2.2 - Jelly Bean):工作
- Galaxy S4(Android 4.4.2 - KitKat):工作
- Galaxy S5(Android 4.4.2 - KitKat):工作
- Galaxy S Plus(Android 2.3.3 - Gingerbread):工作
- Galaxy Ace(Android 2.3.6 - Gingerbread):工作
- Galaxy S2(Android 4.1.2 - Jelly Bean):工作
- Galaxy S3(Android 4.3 - Jelly Bean):工作
- Galaxy Note 2 (Android 4.3 - Jelly Bean):工作
- Galaxy Nexus(Android 4.2.1 - Jelly Bean):工作
- Galaxy S3 Mini (Android 4.1.2 - Jelly Bean): Working
- Galaxy S4 Mini (Android 4.2.2 - Jelly Bean): Working
- Galaxy S4 (Android 4.4.2 - KitKat): Working
- Galaxy S5 (Android 4.4.2 - KitKat): Working
- Galaxy S Plus (Android 2.3.3 - Gingerbread): Working
- Galaxy Ace (Android 2.3.6 - Gingerbread): Working
- Galaxy S2 (Android 4.1.2 - Jelly Bean): Working
- Galaxy S3 (Android 4.3 - Jelly Bean): Working
- Galaxy Note 2 (Android 4.3 - Jelly Bean): Working
- Galaxy Nexus (Android 4.2.1 - Jelly Bean): Working
摩托罗拉
- Moto G(Android 4.4.2 - KitKat):工作
LG
- Nexus 5(Android 4.4.2 - KitKat):工作
中兴
- Blade(Android 2.1 - Eclair):工作
希望能帮到您,如果您有任何其他问题或其他任何不清楚的地方,请随时提问!
I hope I could help you and if you have any further questions or anything else is unclear please feel free to ask!
这篇关于如何与 NavigationDrawer 一起滑动 ActionBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!