突出菜单抽屉选择的项目/滑动菜单 [英] Highlighting Selected item in menu-drawer/sliding menu
问题描述
库中使用:的
Library Used:
- <一个href="https://github.com/SimonVT/android-menudrawer">https://github.com/SimonVT/android-menudrawer
- <一个href="https://github.com/JakeWharton/ActionBarSherlock">https://github.com/JakeWharton/ActionBarSherlock
- <一个href="https://github.com/JakeWharton/Android-ViewPagerIndicator">https://github.com/JakeWharton/Android-ViewPagerIndicator
- https://github.com/SimonVT/android-menudrawer
- https://github.com/JakeWharton/ActionBarSherlock
- https://github.com/JakeWharton/Android-ViewPagerIndicator
问:的
Question:
我一直在试图实现对高亮类似YouTube /美丽的Widget应用程序的menudrawer,但我不知道要怎么应该解决这个问题。
I have been trying to implement highlighting on the menudrawer similar to YouTube/Beautiful Widget app, but i have no clue to how is should approach the problem.
下面我给一个样本,我aprproche这我不知道,如果它的实现这样的事情的正确方法:
below i am giving a sample to my aprproche which i am not sure, if its the correct way to implement something like this:
这是一个菜单抽屉Adaptervew.click lisner我创建的:的
This is a Menu drawer Adaptervew.click lisner i created:
private AdapterView.OnItemClickListener mItemClickListener = new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
mPreviousView=mActiveView;
mActiveView=view;
mActivePosition = position;
// mDrawer.setActiveView(view, position);
TextView txtview=(TextView)mActiveView;
txtview.setBackgroundResource( R.drawable.abs__cab_background_top_holo_dark);
// mDrawer.closeMenu();
}
};
所以基本上我试图做的,是用在当前选择的视图0.9形象!
So basically what i am trying to do here is to use a .9 image on the current selected view!
我想知道的是有一个更系统的或更好的方法做同样的!
我想才达到以下屏幕快照是什么:: 的
What i want to achive Screen Shots below::
推荐答案
您可以试试看:
public View getView(int position, View convertView, ViewGroup parent) {
view.setSelectionHandlerColorResource(Set your color here);
}
这篇关于突出菜单抽屉选择的项目/滑动菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!