2015年4月1日水曜日

Webサイト上に綺麗にソースコードを表示する方法『SyntaxHighlighter』

今ごろになって、『SyntaxHighlighter』を使うという方法を知った。

テスト
package lesson.studyandroid;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class SubActivity_A extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        String str = "";

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_a);

        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            str = extras.getString("SELECTED_DATA");
        }
        TextView txtView = (TextView)findViewById(R.id.textView1);
        txtView.setText(str);

        Button button = (Button) findViewById(R.id.button1);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();   // アクティビティ終了
            }
        });
    }
}

わぁお、きれい。
こんなに簡単だったなんて知らなかった(笑)



0 件のコメント:

コメントを投稿