I need to achieve a navigation menu such as this:
I don't want to use Navigation drawer since I am already using it for other purposes.
Let me explain a little bit the situation:
I have a navigation drawer that shows a listview with some options. When user clicks on an option, navigation drawer disappear and in may content view should show some buttons with the look & feel as the image above.
When a button is pressed, a new view (corresponding to button selection) should slide in from the right.
How can I achieve this? I have not found a good resource for this.
Thanks Jaime
I have done it finally by using a ListView.
This is the code,and I can assure it is not confusing, and in fact, this is done in every android app:
public void DrawAreas() {
final ListView areaView = (ListView) _activity.findViewById(R.id.area_list);
ArrayAdapter<TdcArea> areas = new ArrayAdapter<TdcArea>(_activity.getApplicationContext(),
android.R.layout.simple_list_item_1,
_system.getAreas()) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
TextView text = (TextView) view.findViewById(android.R.id.text1);
text.setTextColor(Color.BLACK);
Drawable icon = ContextCompat.getDrawable(_activity.getApplicationContext(), R.drawable.chevron_red);
text.setCompoundDrawablesWithIntrinsicBounds(null, null, icon, null);
return view;
}
};
areaView.setAdapter(areas);
areaView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
TdcArea area = (TdcArea) areaView.getItemAtPosition(position);
Intent intent = new Intent(_activity.getApplicationContext(), FormActivity.class);
intent.putExtra("AREA", area);
_activity.startActivity(intent);
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.