xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FileExplorerActivity" >
android:id="@+id/currentTv"
android:layout_alignParentTop="true"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:id="@+id/fileLv"
android:layout_below="@id/currentTv"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
布局很简单,就是放置了一个ListView控件,这里要注意的是,ListView标签下不能再放入其他的子控件。内容是通过子布局和Adapter来显示的。
2.ListView中的子布局file_list_item.xml
< xml version="1.0" encoding="utf-8" >
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:id="@+id/filename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
子布局也很简单,就是在水平方向上左边显示一个图标,用来显示文件夹或文件图标,右边显示文件名。