当前位置: 代码迷 >> Android >> Android 兑现底部菜单栏
  详细解决方案

Android 兑现底部菜单栏

热度:49   发布时间:2016-05-01 14:14:18.0
Android 实现底部菜单栏
		menu.setNumColumns(5);// 设置每行列数		menu.setGravity(Gravity.CENTER);// 位置居中		menu.setVerticalSpacing(10);// 垂直间隔		menu.setHorizontalSpacing(10);// 水平间隔		menu.setAdapter(getMenuAdapter(a));		menu.setOnItemClickListener(new OnItemClickListener() {			@Override			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,					long arg3) {				// TODO Auto-generated method stub				switch (arg2) {				case 0:					break;				case 1:					break;				case 2:										break;				case 3:					break;				case 4:									break;				}			}		});	}

?

private ListAdapter getMenuAdapter(String[] a2) {		// TODO Auto-generated method stub		ArrayList<HashMap<String, Object>> data = new ArrayList<HashMap<String, Object>>();		for (int i = 0; i < a2.length; i++) {			HashMap<String, Object> map = new HashMap<String, Object>();			map.put("itemText", a2[i]);			data.add(map);		}		SimpleAdapter simperAdapter = new SimpleAdapter(this, data,				R.layout.item, new String[] { "itemText" },				new int[] { R.id.item_text });		return simperAdapter;	}

?

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"	android:id="@+id/RelativeLayout_Item"	android:layout_width="fill_parent" android:layout_height="wrap_content"	android:paddingBottom="5dip">	<TextView android:id="@+id/item_text"		android:layout_centerHorizontal="true" android:layout_width="wrap_content"		android:layout_height="wrap_content" android:textColor="#FFFFFFFF"></TextView></RelativeLayout>

?

  相关解决方案