2016-12-27 59 views

回答

0

店浮动操作按钮时,需要它来恢复按钮到原来的位置这样

LayoutParams positionOfButton = floatingActionButton.getLayoutParams(); 

,并再次移动之前以前的位置做到这一点,

floatingActionButton.setLayoutParams(positionOfButton); 
0

你可以做到这一点使用sharedPreferences概念。您必须捕捉FAB的坐标并将其存储在偏好中。

SharedPreferences sp=getSharedPreferences("values",0); 
int[] i=new int[2]; 
    FAB.getLocationOnScreen(i); 
    sp.edit().putString(i[0]+"").commit(); 
    sp.edit().putString(i[1]+"").commit(); 
    //while retrieving parse to double. and then set 
    FAB.setX(x); 
    FAB.setY(y); //where x and y are double values from sharedpreferences.