<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/epdLayout" android:orientation="vertical"
android:layout_width="600px" android:layout_height="800px"
android:visibility="invisible">
</LinearLayout>
public class HelloActivity extends Activity {
private EpdRender epd = new EpdRender() {
public boolean onEpdScreenPainting(View view, Canvas canvas) {
float width = (float) getEpdScreenWidth();
float height = (float) getEpdScreenHeight();
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setTextSize(30);
String text = HelloActivity.this.getString(R.string.hello);
float textWidth = paint.measureText(text);
canvas.drawText(text, (width - textWidth) / 2, height / 2, paint);
return true;
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.epd);
LinearLayout epdLayout = (LinearLayout) findViewById(R.id.epdLayout);
this.epd.bindLayout(epdLayout);
this.epd.updateEpdView();
}
@Override
protected void onResume() {
super.onResume();
this.epd.setVdsActive(true);
}
@Override
protected void onStop() {
super.onStop();
this.epd.setVdsActive(false);
}
}
LocalActivityManager m = this.getLocalActivityManager();
Intent intent = new Intent(MainActivity.this, HelloActivity.class);
m.startActivity("HELLO", intent);
Author:miyabet
ブログ出版局は
http://print.cssj.jp/
です。
