能不能够语法高亮显示。
显示成下面这个样子(类似于eclipse的样子):

发件人 snapshoot

使用wp-syntax来标记:
http://www.c2cer.com/20081128/wp-syntax-plugins-code/
参考这来实现一键插入:
编辑:\wp-includes\js\quicktags.js

发件人 snapshoot

代码中加入:

发件人 snapshoot

package com.qisda.weather;
import android.app.Activity;
import android.os.Bundle;
import android.view.*;
import android.view.View.OnFocusChangeListener;
import android.view.View.OnTouchListener;
import android.widget.ImageView;

public class weatherUI extends Activity implements OnTouchListener {
/** Called when the activity is first created. */

private ImageView w1;
private ImageView w2;
private ImageView w3;
private ImageView w4;

private ImageView wcurrent;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

w1 = (ImageView) findViewById(R.id.w1);
w2 = (ImageView) findViewById(R.id.w2);
w3 = (ImageView) findViewById(R.id.w3);
w4 = (ImageView) findViewById(R.id.w4);
wcurrent = (ImageView) findViewById(R.id.wcurrent);

w1.setBackgroundResource(R.drawable.weather_clear);
w2.setBackgroundResource(R.drawable.weather_clear_night);
w3.setBackgroundResource(R.drawable.weather_cloudy);
w4.setBackgroundResource(R.drawable.weather_showers);
wcurrent.setBackgroundResource(R.drawable.weather_storm);

/*
* wcurrent.setOnFocusChangeListener(new View.OnFocusChangeListener() {
* public void onFocusChange(View v, boolean hasFocus) { if (true ==
* hasFocus) { wcurrent.setBackgroundDrawable(v.getBackground());
*
* } else {
*
* } } }); / wcurrent.setOnTouchListener(new View.OnTouchListener() {
* public boolean onTouch(View v, MotionEvent event) {
*
* return true; }
*
* });
*/

w1.setOnTouchListener(this);
w2.setOnTouchListener(this);
w3.setOnTouchListener(this);
w4.setOnTouchListener(this);
wcurrent.setOnTouchListener(this);

}

@Override
public boolean onTouch(View v, MotionEvent event) {
//ImageView imageview = (ImageView)findViewById(v.getId());
//imageview.setBackgroundDrawable(v.getBackground());

switch (v.getId()) {
case R.id.w1:
wcurrent.setBackgroundDrawable(v.getBackground());
break;
case R.id.w2:
wcurrent.setBackgroundDrawable(v.getBackground());
break;

case R.id.w3:
wcurrent.setBackgroundDrawable(v.getBackground());
break;

case R.id.w4:
wcurrent.setBackgroundDrawable(v.getBackground());
break;

case R.id.wcurrent:
wcurrent.setBackgroundDrawable(v.getBackground());
break;

default:
break;

}
return true;
}
}
写日志时怎么格式化代码

3 thoughts on “写日志时怎么格式化代码

  • May 27, 2009 at 1:03 am
    Permalink

    可以的,启用那个wp-syntax插件,那个插件的说明里有教你怎么使用的

    Reply
  • May 27, 2009 at 2:39 pm
    Permalink

    今天刚从blogger搬家到自己的VPS,用了n年没用过的wordpress,也装上了wp-syntax这个插件,非常好用

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.