Android 在片段活动中插入按钮和菜单(幻灯片菜单)
我有一个带有SupportMapFragment的FragmentActivity。我想添加按钮,菜单,幻灯片菜单…我怎么能做到这一点 这是我的密码:Android 在片段活动中插入按钮和菜单(幻灯片菜单),android,android-fragments,Android,Android Fragments,我有一个带有SupportMapFragment的FragmentActivity。我想添加按钮,菜单,幻灯片菜单…我怎么能做到这一点 这是我的密码: public class MapsActivity extends FragmentActivity { private GoogleMap mMap; // Might be null if Google Play services APK is not available. private LocalizeDB db; @Overrid
public class MapsActivity extends FragmentActivity {
private GoogleMap mMap; // Might be null if Google Play services APK is not available.
private LocalizeDB db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
setUpMapIfNeeded();
db = new LocalizeDB(this);
}
@Override
protected void onResume() {
super.onResume();
setUpMapIfNeeded();
}
private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
// Try to obtain the map from the SupportMapFragment.
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
// Check if we were successful in obtaining the map.
if (mMap != null) {
setUpMap();
}
}
}
是的一个子类。对于一项活动,您所做的大部分事情都可以通过一项零碎的活动来完成。这里陈述了一些不同之处
我认为您将使用活动地图布局来放置其他按钮。幻灯片菜单可以作为一个菜单来实现。如果我错过了什么,请告诉我
希望有帮助