我开发了一个简单的应用程序,并面临着这样的问题。 ListView不响应SlidingMenu中的点击次数
创建SlidingMenu
private SlidingMenu menu;
---
menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeBehind(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowDrawable(R.drawable.shadows_menu_swype1);
menu.setShadowWidth(15);
menu.setFadeDegree(0.50f);
menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
menu.setBehindWidth(300);
menu.setMenu(R.layout.menu_swype);
如何创建ListView
SwypeMenuLV = (ListView) findViewById(R.id.menu_swypeID);
String[] menu_swypeStr = getResources().getStringArray(R.array.menu_swypeSTR);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item_menu_swype, menu_swypeStr);
SwypeMenuLV.setAdapter(adapter);
ListView事件处理程序
SwypeMenuLV.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
toast.setText("TEST!");
toast.show();
}
});
XML ListView
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shadows_menu_swype2"
android:orientation="vertical" >
<ListView
android:id="@+id/menu_swypeID"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:divider="@drawable/boder_menu_swype"
android:dividerHeight="2dp">
</ListView>
list_item_menu_swype.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textColor="#f4f5f5"
android:textSize="18sp"
>
</TextView>
有什么问题? 请帮助!)