你好,游客 登录 注册 搜索
背景:
阅读新闻

Android--查找程序根目录下所有文件/Java IO操作

[日期:2013-02-03] 来源:Linux社区  作者:dlutbrucezhang [字体:大 中 小]

Android--查找程序根目录下所有文件/Java IO操作实例实现的是浏览根目录下所有的文件,包含子目录下所有的文件,类似于实现“Windows资源管理器”,首先,先看下程序的实现截图:

这个程序应用的是ListActivity和JavaIO的知识。

首先,让我们先看下主程序的布局文件定义:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:orientation="vertical"
>
  <TextView
    android:id="@+id/mPath"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="5px"
    android:textSize="18sp"
    android:textColor="@drawable/blue"
  />
  <ListView
    android:id="@android:id/list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
  />
</LinearLayout>

其中,ListView中的各个子TextView也是由程序提供,布局文件如下:

<?xml version="1.0" encoding="utf-8"?>
<TextView
  android:id="@+id/text1"
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:textSize="20sp"
/>

linux
相关资讯       Android根目录  Android IO 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款