I am new bea to android and want to open a list view/menu (see image:2) after click on image/button (see image:1). I am not sure whether it is list or dialog or some other component. Please help me out.
我是android的新手,想要在点击图像/按钮后打开列表视图/菜单(见图像:2)(见图像:1)。我不确定它是列表,对话框还是其他组件。请帮帮我。
3 个解决方案
#1
#2
1
That is Drop-Down navigation for the ActionBar, you can check official documentation for the same: Adding Drop-down Navigation.
这是ActionBar的Drop-Down导航,您可以查看相同的官方文档:添加下拉导航。
ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
actionBar.setListNavigationCallbacks(mSpinnerAdapter, mNavigationCallback);
// It takes your SpinnerAdapter and ActionBar.OnNavigationListener.
Check Examples:
- Adding Drop down navigation to action bar in Android
- Adapter part 1 on Styling Android
将下拉导航添加到Android中的操作栏
Styling Android上的适配器第1部分
Update:
To provide app compatibility for the lower Android version, I would suggest you to include actionbarsherlock library, once you will download it, you will be able to access many samples too.
为了为较低的Android版本提供应用程序兼容性,我建议您添加actionbarsherlock库,一旦下载它,您也可以访问许多样本。
#3
0
It is a Spinner in Android. Please check below link
它是Android中的Spinner。请检查以下链接
http://developer.android.com/guide/topics/ui/controls/spinner.html
If you want to implement behavior like GMail, then you need to override getView method of your Spinner Adapter
如果你想实现像GMail这样的行为,那么你需要覆盖Spinner Adapter的getView方法
#1
1
its ActionBar.NAVIGATION_MODE_LIST
check this link Because it Working for All Android OS Version
检查此链接因为它适用于所有Android操作系统版本
in that many sample available for more details check this artical
在许多样本可用于更多细节检查这个artical
#2
1
That is Drop-Down navigation for the ActionBar, you can check official documentation for the same: Adding Drop-down Navigation.
这是ActionBar的Drop-Down导航,您可以查看相同的官方文档:添加下拉导航。
ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
actionBar.setListNavigationCallbacks(mSpinnerAdapter, mNavigationCallback);
// It takes your SpinnerAdapter and ActionBar.OnNavigationListener.
Check Examples:
- Adding Drop down navigation to action bar in Android
- Adapter part 1 on Styling Android
将下拉导航添加到Android中的操作栏
Styling Android上的适配器第1部分
Update:
To provide app compatibility for the lower Android version, I would suggest you to include actionbarsherlock library, once you will download it, you will be able to access many samples too.
为了为较低的Android版本提供应用程序兼容性,我建议您添加actionbarsherlock库,一旦下载它,您也可以访问许多样本。
#3
0
It is a Spinner in Android. Please check below link
它是Android中的Spinner。请检查以下链接
http://developer.android.com/guide/topics/ui/controls/spinner.html
If you want to implement behavior like GMail, then you need to override getView method of your Spinner Adapter
如果你想实现像GMail这样的行为,那么你需要覆盖Spinner Adapter的getView方法