xml
<ListView android:id="@+id/list1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
java
ListView listView1 = (ListView)findViewById(R.id.list1);
String[] item = {"文件1","文件2","文件3","文件4"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(Context_Menu.this, android.R.layout.simple_dropdown_item_1line, item);
listView1.setAdapter(adapter);
//给视图提供上下文菜单
registerForContextMenu(listView1);