setContentView(R.layout.activity_main); tv = (TextView) findViewById(R.id.tv); // 声明资源变量 Resources res = getResources(); //获得输入流 InputStream in = res.openRawResource(R.raw.text); Scanner sc = new Scanner(in); while(sc.hasNext()){ tv.append(sc.next()); } }
时间: 2024-11-05 11:46:09