当我单击屏幕创建节点时,我试图获取它,但通过 Viwerpipe,我唯一能做的就是删除已经创建的节点。
public class Activity_TestManySprite extends Activity implements ViewerListener {
private static final int CONTENT_VIEW_ID = 10101010;
private DefaultFragment fragment ;
private Graph graph ;
protected boolean loop = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FrameLayout frame = new FrameLayout(this);
frame.setId(CONTENT_VIEW_ID);
setContentView(frame, new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
graph = new MultiGraph("TestSize");
graph.setAttribute("ui.antialias");
display(savedInstanceState, graph, true);
}
@Override
protected void onStart() {
super.onStart();
ViewerPipe pipe = fragment.getViewer().newViewerPipe();
pipe.addAttributeSink( graph );
pipe.addViewerListener( this );
pipe.pump();
graph.setAttribute( "ui.stylesheet", styleSheet );
graph.setAttribute( "ui.antialias" );
}
public void display(Bundle savedInstanceState, Graph graph, boolean autoLayout) {
if (savedInstanceState == null) {
FragmentManager fm = getFragmentManager();
fragment = (DefaultFragment)fm.findFragmentByTag("fragment_tag");
if (null == fragment) {
fragment = new DefaultFragment();
fragment.init(graph, autoLayout);
}
FragmentTransaction ft = fm.beginTransaction() ;
ft.add(CONTENT_VIEW_ID, fragment).commit();
}
}
public void buttonPushed( String id ) {
graph.removeNode(id);
}
public void buttonReleased(String id) {
}
public void mouseOver(String id) {
}
public void mouseLeft(String id) {
}
public void viewClosed(String viewName) {
}
}
我搜索了很多地方但我没有找到如何使用触摸屏来做到这一点,我通常发现这个链接说它有用但我不明白:我搜索了很多地方但我没有找到如何使用触摸屏做到这一点,我通常发现这个链接说它很有用但我无法理解:https://github.com/graphstream/gs-ui-android-test/tree/master/app/src/main/ java/ui/graphstream/org/gs_ui_androidtestFull