Android文件资源管理器使用带缩略图的列表视图和多个选项(通过长按一行切换为单选项)
我有一个使用ListView图标+文本的文件管理器。。我只想为photosjpg显示预览,而不是默认图标。。像es文件浏览器或类似的 我想从单选列表视图切换。。通过长按listview上的一行来进行多个_选择。。就像android消息系统应用程序上发生的一样。。。通过选定行上的高亮显示。。。没有支票箱 我的实际情况是: 我的ListView对每一行使用RelativeLayoutAndroid文件资源管理器使用带缩略图的列表视图和多个选项(通过长按一行切换为单选项),android,listview,explorer,thumbnails,multipleselection,Android,Listview,Explorer,Thumbnails,Multipleselection,我有一个使用ListView图标+文本的文件管理器。。我只想为photosjpg显示预览,而不是默认图标。。像es文件浏览器或类似的 我想从单选列表视图切换。。通过长按listview上的一行来进行多个_选择。。就像android消息系统应用程序上发生的一样。。。通过选定行上的高亮显示。。。没有支票箱 我的实际情况是: 我的ListView对每一行使用RelativeLayout <?xml version="1.0" encoding="utf-8"?> <RelativeL
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="60dip"
android:padding="5dip">
<ImageView
android:id="@+id/fd_Icon"
android:layout_width="50dip"
android:layout_height="50dip"
>
</ImageView>
<TextView
android:text="Nome"
android:layout_marginLeft="5dip"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/fd_Text"
android:layout_toRightOf="@+id/fd_Icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></TextView>
</RelativeLayout>
我像这样填充列表视图
//arrayItemT contains all files and directories of the current path
ArrayList<FileDirRow> lista_file_dir =new ArrayList<FileDirRow>();
for(int i=0;i<arrayItemT.size();i++){
if (arrayItemT.get(i).endsWith("/"))
lista_file_dir.add(new FileDirRow(R.drawable.folder, arrayItemT.get(i)));
else
-----------------------------------------------------------------------------
//if it's a photo add thumbnails or if it's a generic file...
lista_file_dir.add(new FileDirRow(R.drawable.file, arrayItemT.get(i)));
-----------------------------------------------------------------------------
}
//popolate list
ArrayList<HashMap<String, Object>> data=new ArrayList<HashMap<String,Object>>();
for(int i=0;i<arrayItemT.size();i++){
FileDirRow p= lista_file_dir.get(i);
HashMap<String,Object> rowMap=new HashMap<String, Object>();//create value map
rowMap.put("image", p.getFileDirIcon()); //for image key,image res
rowMap.put("name", p.getFileDirText()); //for name key,l'informazine sul nome
data.add(rowMap); //add value map to data source
}
String[] from={"image","name"}; //from value under this key
int[] to={R.id.fd_Icon,R.id.fd_Text};//to views id
//create adapter
SimpleAdapter adapter=new SimpleAdapter(
getApplicationContext(),
data,//sorgente dati
R.layout.icon_row, //layout
from,
to);
//use adapter
((ListView)findViewById(R.id.FileDirList)).setAdapter
//arrayItemT contains all files and directories of the current path
ArrayList<FileDirRow> lista_file_dir =new ArrayList<FileDirRow>();
for(int i=0;i<arrayItemT.size();i++){
if (arrayItemT.get(i).endsWith("/"))
lista_file_dir.add(new FileDirRow(R.drawable.folder, arrayItemT.get(i)));
else
-----------------------------------------------------------------------------
//if it's a photo add thumbnails or if it's a generic file...
lista_file_dir.add(new FileDirRow(R.drawable.file, arrayItemT.get(i)));
-----------------------------------------------------------------------------
}
//popolate list
ArrayList<HashMap<String, Object>> data=new ArrayList<HashMap<String,Object>>();
for(int i=0;i<arrayItemT.size();i++){
FileDirRow p= lista_file_dir.get(i);
HashMap<String,Object> rowMap=new HashMap<String, Object>();//create value map
rowMap.put("image", p.getFileDirIcon()); //for image key,image res
rowMap.put("name", p.getFileDirText()); //for name key,l'informazine sul nome
data.add(rowMap); //add value map to data source
}
String[] from={"image","name"}; //from value under this key
int[] to={R.id.fd_Icon,R.id.fd_Text};//to views id
//create adapter
SimpleAdapter adapter=new SimpleAdapter(
getApplicationContext(),
data,//sorgente dati
R.layout.icon_row, //layout
from,
to);
//use adapter
((ListView)findViewById(R.id.FileDirList)).setAdapter