Unten (speziell in fixMapControlLocations
) habe ich dies mit ActionBarSherlock angesprochen.
Probleme, die ich hatte, waren auf schmalen Bildschirmen und die Split-Action-Leiste hatte den falschen Offset abhängig von der Rotation. Die isNarrow
Kontrolle durch Sherlock lässt mich wissen, ob es eng ist.
Eine weitere wichtige Änderung ist die Festlegung der Auffüllung der übergeordneten Ansicht von myLocation. Dies greift alle Steuerelemente auf und basierend auf dem Hierarchieviewer funktioniert Google Maps. Das Google-Attributionslogo befindet sich auf dem nächsten übergeordneten Baum in einem Surface-Objekt. Wenn man nicht so aussieht, ist es leicht zu bewegen, also werde ich wahrscheinlich am Ende den Transparenzeffekt der unteren Aktionsleiste verlieren, um in Übereinstimmung zu bleiben.
protected void onCreate(Bundle savedInstanceState) {
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
setUpMapIfNeeded();
getSupportActionBar().setBackgroundDrawable(d);
getSupportActionBar().setSplitBackgroundDrawable(d);
}
private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the
// map.
if (map == null) {
// Try to obtain the map from the SupportMapFragment.
map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getExtendedMap();
// Check if we were successful in obtaining the map.
if (map != null) {
setUpMap();
}
}
}
private void setUpMap() {
fixMapControlLocations();
.....
}
private void fixMapControlLocations() {
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
int actionBarHeight = 0;
TypedValue tv = new TypedValue();
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
{
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics());
}
View myLocationParent = ((View)mapFragment.getView().findViewById(1).getParent());
View myLocationParentParent = ((View)myLocationParent.getParent());
myLocationParentParent.setPadding(0, actionBarHeight, 0, isNarrow()?actionBarHeight:0);
}
public boolean isNarrow() {
return ResourcesCompat.getResources_getBoolean(getApplicationContext(),
R.bool.abs__split_action_bar_is_narrow);
}
http://stackoverflow.com/a/20750956/1066839 – John