parent
41aabb009e
commit
3a15914218
@ -0,0 +1,46 @@
|
||||
package net.micode.notes.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import net.micode.notes.PaintView;
|
||||
import net.micode.notes.R;
|
||||
|
||||
public class BoardActivity extends Activity {
|
||||
private PaintView paintView;
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState); //调用父类的功能
|
||||
this.setContentView(R.layout.activity_paint);
|
||||
//根据id获取添加图片按钮
|
||||
final ImageButton undo = (ImageButton) findViewById(R.id.undo);
|
||||
//为点击图片按钮设置监听器
|
||||
undo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
paintView.undo();
|
||||
}
|
||||
});
|
||||
|
||||
final ImageButton paint_reset = (ImageButton) findViewById(R.id.paint_reset);
|
||||
//为点击图片按钮设置监听器
|
||||
paint_reset.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
paintView.redo();
|
||||
}
|
||||
});
|
||||
|
||||
final ImageButton paint_delete = (ImageButton) findViewById(R.id.paint_delete);
|
||||
//为点击图片按钮设置监听器
|
||||
paint_delete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
paintView.removeAllPaint();
|
||||
}
|
||||
});
|
||||
paintView = (PaintView)findViewById(R.id.paint_layout);
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 5.9 KiB |
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
>
|
||||
|
||||
<net.micode.notes.PaintView
|
||||
android:id="@+id/paint_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"></net.micode.notes.PaintView>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/paint_reset"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="240dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:src="@drawable/paint_reset" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/paint_clor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="80dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:src="@drawable/paint_clor" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/paint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="0dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:src="@drawable/paint" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/paint_delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="320dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:src="@drawable/paint_delete" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/undo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="160dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:src="@drawable/undo" />
|
||||
|
||||
</RelativeLayout>
|
Loading…
Reference in new issue