标签:
基于SkylineGlobe提供的安卓版本SDK,在已有菜单中增加自定义内容,测试代码如下:
新增加文件ZhaoHeContainer.java
package com.skyline.terraexplorer.tools; import java.util.concurrent.Callable; import android.widget.Toast; import com.skyline.teapi.IFeatureLayer; import com.skyline.teapi.ISGWorld; import com.skyline.terraexplorer.R; import com.skyline.terraexplorer.TEApp; import com.skyline.terraexplorer.models.MenuEntry; import com.skyline.terraexplorer.models.UI; public class ZhaoHeContainer extends BaseToolWithContainer { @Override public MenuEntry getMenuEntry() { return MenuEntry.createFor(this, R.string.zhaohe_tool, R.drawable.navigate_plus, 80); } @Override public boolean onBeforeOpenToolContainer() { toolContainer.setText(String.format("New Tool")); toolContainer.addButton(1, R.drawable.label); toolContainer.addButton(2, R.drawable.add_polyline); toolContainer.addButton(3, R.drawable.add_polygon); toolContainer.addButton(4, R.drawable.list); return true; } @Override public void onButtonClick(int tag) { IFeatureLayer layer = null; switch (tag) { case 1: Toast.makeText(TEApp.getAppContext(), "A button 1", Toast.LENGTH_SHORT).show(); break; case 2: Toast.makeText(TEApp.getAppContext(), "A button 2", Toast.LENGTH_SHORT).show(); break; case 3: Toast.makeText(TEApp.getAppContext(), "A button 3", Toast.LENGTH_SHORT).show(); break; case 4: Toast.makeText(TEApp.getAppContext(), "A button 4", Toast.LENGTH_SHORT).show(); break; } } }
在ToolManager.java中添加:
registerTool(new ZhaoHeContainer());
标签:
原文地址:http://www.cnblogs.com/yitianhe/p/5020019.html