0
我正在製作一個繪畫應用程序,以瞭解如何使用eclipse。path.reset與菜單項onclick
只要點擊菜單項「重置」,我想清除我的(繪畫)視圖 菜單項「重置」在XML文件中。現在我知道我必須使用path.reset,但不知道在哪裏寫它。希望有人能幫助我。
<item android:id="@+id/ResetAction"
android:orderInCategory="100"
android:title="Reset"
android:showAsAction="never"
android:menuCategory="container"
></item>
一個
public class SingleTouchActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new SingleTouchEventView(this, null));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.main_fragment, container,
false);
return rootView;
}
}
}