2016-03-24 6 views
0

I create Schwimmdock Knopf in meiner App:Position Knopf von Schwimmdock ist in manchen Geräten nicht wahr, beispielsweise für Samsung S3 und Nexus 6

<android.support.design.widget.FloatingActionButton 
     android:id="@+id/add_fab_detail_activity" 
     android:layout_alignParentTop="true" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ic_add_white" 
     fab:backgroundTint="@color/FABNormal" 
     fab:rippleColor="@color/FABPressed" /> 

Wenn der Test auf SamSung S3 und Nexus 6, ich sehe Position von Fab ist anders auf diesen divices. Ich denke, Position in S3 ist falsch! Bitte hilf mir!

enter image description here

Antwort

0
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 
        mParamsAddButton.setMargins(mMapView.getWidth() - mAddFab.getWidth()/2, mMapView.getHeight()*3/4, 0, 0); 
       } else { 
        mParamsAddButton.setMargins(mMapView.getWidth() - mAddFab.getWidth()/2, mMapView.getHeight()/2, 0, 0); 
       }