-1

Ex: I have a project with UI contains a button.. Activity:

package android.tuanshaker.myproject.com;
import android.app.Activity;
import android.os.Bundle;

public class MyProjectActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
}
}

And file main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello" />

</LinearLayout>

I want to display code and xml of my project by textview..How do i can to get them?

4

1 回答 1

1

Copy the xml, js code files to res/raw. Use Context.getResources().openRawResource() to read them.

In addition, you can use jHighlight to format those source codes (in a web view).

于 2012-05-26T15:02:37.180 回答