本文整理汇总了Java中android.support.design.widget.FloatingActionButton.hide方法的典型用法代码示例。如果您正苦于以下问题:Java FloatingActionButton.hide方法的具体用法?Java FloatingActionButton.hide怎么用?Java FloatingActionButton.hide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.FloatingActionButton
的用法示例。
在下文中一共展示了FloatingActionButton.hide方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton fab,
final View target, final int dxConsumed, final int dyConsumed,
final int dxUnconsumed, final int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, fab, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
if (!enabled) return;
if (dyConsumed > 0 && fab.getVisibility() == View.VISIBLE) {
// User scrolled down and the FAB is currently visible -> hide the FAB
fab.hide();
} else if (dyConsumed < 0 && fab.getVisibility() != View.VISIBLE) {
// User scrolled up and the FAB is currently not visible -> show the FAB
fab.postDelayed(new Runnable() {
@Override
public void run() {
fab.show();
}
}, 200L);
}
}
示例2: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child,
View target, int dxConsumed, int dyConsumed, int dxUnconsumed,
int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
child.hide();
RxBus.getInstance().post(AppConstant.MENU_SHOW_HIDE,false);
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
RxBus.getInstance().post(AppConstant.MENU_SHOW_HIDE,true);
child.show();
}
}
示例3: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull FloatingActionButton child, @NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
//Logger.d("FABBehavour", String.valueOf(dyConsumed));
if (child.isShown() && dyConsumed > 0) {
child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
@Override
public void onHidden(FloatingActionButton fab) {
super.onHidden(fab);
fab.setVisibility(View.INVISIBLE);
}
});
} else if (!child.isShown() && dyConsumed < 0) {
child.show();
}
}
示例4: setUpActivity
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
protected void setUpActivity(String title, int navDrawerId, boolean withFab, boolean withRefresh) {
getActivity().setTitle(title);
if (mListener != null) {
mListener.checkNavigationDrawerItem(navDrawerId);
}
FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
if (withFab) {
fab.show();
} else {
fab.hide();
}
fab.setOnClickListener(null);
SwipeRefreshLayout srl = (SwipeRefreshLayout) getActivity().findViewById(R.id.swipe_container);
srl.setEnabled(withRefresh);
srl.setRefreshing(false);
srl.setOnRefreshListener(null);
}
示例5: hideFab
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
public static void hideFab(@Nullable FloatingActionButton fab)
{
if (fab == null)
return;
if (ViewCompat.isLaidOut(fab))
{
fab.hide();
return;
}
fab.animate().cancel();
fab.setScaleX(1f);
fab.setScaleY(1f);
fab.setAlpha(1f);
fab.setVisibility(View.GONE);
fab.animate().setDuration(200).scaleX(0).scaleY(0).alpha(0).setInterpolator(new LinearOutSlowInInterpolator());
}
示例6: onCreateView
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
getActivity().setTitle(getString(R.string.frag_notif_title));
if (mListener != null) {
mListener.checkNavigationDrawerItem(R.id.nav_notif);
}
FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
fab.hide();
SwipeRefreshLayout srl = (SwipeRefreshLayout) getActivity().findViewById(R.id.swipe_container);
srl.setEnabled(false);
IntentFilter filter = new IntentFilter();
filter.addAction(MainActivity.ACTION_MAIN_SERVICE_BOUND);
filter.addAction(MainService.ACTION_UPDATE_TOPOLOGY_FINISHED);
LocalBroadcastManager bm = LocalBroadcastManager.getInstance(view.getContext());
bm.registerReceiver(mBroadcastReceiver, filter);
return view;
}
示例7: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child,
View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed,
dyUnconsumed);
if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
@Override
public void onHidden(FloatingActionButton fab) {
super.onShown(fab);
fab.setVisibility(View.INVISIBLE);
}
});
} else if (dyConsumed < 0){
child.show();
}
}
示例8: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final
FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed,
final int dxUnconsumed, final int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed,
dxUnconsumed, dyUnconsumed);
if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
/** design lib 升级到 25.1.0 导致 child.hide() 效果失效,法克哟
* http://stackoverflow.com/questions/41761736/android-design-library-25-1-0-causes-floatingactionbutton-behavior-to-stop-worki
*/
child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
@Override
public void onHidden(FloatingActionButton fab) {
super.onHidden(fab);
fab.setVisibility(View.INVISIBLE);
}
});
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
child.show();
}
}
示例9: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull FloatingActionButton child,
@NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed,
int dyUnconsumed, int type) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type);
if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
@Override
public void onHidden(FloatingActionButton fab) {
// GONE causes it to stop dispatching events...
fab.setVisibility(View.INVISIBLE);
}
});
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
child.show();
}
}
示例10: onScrolled
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onScrolled(RecyclerView view, int dx, int dy) {
super.onScrolled(view, dx, dy);
ActionButtonActivity activity = (ActionButtonActivity) getActivity();
FloatingActionButton composeButton = activity.getActionButton();
if (composeButton != null) {
if (hideFab) {
if (dy > 0 && composeButton.isShown()) {
composeButton.hide(); // hides the button if we're scrolling down
} else if (dy < 0 && !composeButton.isShown()) {
composeButton.show(); // shows it if we are scrolling up
}
} else if (!composeButton.isShown()) {
composeButton.show();
}
}
}
示例11: handleIntent
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void handleIntent(FloatingActionButton view, Intent intent) {
if (intent.getDataString().startsWith(URI_SHOW)) {
view.show();
} else if (intent.getDataString().startsWith(URI_HIDE)) {
view.hide();
}
}
示例12: animateFab
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
private void animateFab(int tabPos) {
FloatingActionButton fabTasks = (FloatingActionButton) findViewById(R.id.fab_tasks);
FloatingActionButton fabHabits = (FloatingActionButton) findViewById(R.id.fab_habits);
FloatingActionButton fabTimeLeft = (FloatingActionButton) findViewById(R.id.fab_time_left);
switch (tabPos) {
case 0:
fabTasks.show();
fabHabits.hide();
fabTimeLeft.hide();
break;
case 1:
fabTasks.hide();
fabHabits.show();
fabTimeLeft.hide();
break;
case 2:
fabTasks.hide();
fabHabits.hide();
fabTimeLeft.show();
break;
default:
fabTasks.hide();
fabHabits.hide();
fabTimeLeft.hide();
break;
}
}
示例13: onCreate
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
networkId = getIntent().getStringExtra(EXTRA_NETWORK_ID);
lineId = getIntent().getStringExtra(EXTRA_LINE_ID);
} else {
networkId = savedInstanceState.getString(STATE_NETWORK_ID);
lineId = savedInstanceState.getString(STATE_LINE_ID);
}
Object conn = getLastCustomNonConfigurationInstance();
if (conn != null) {
// have the service connection survive through activity configuration changes
// (e.g. screen orientation changes)
mConnection = (LocServiceConnection) conn;
mainService = mConnection.getBinder().getService();
locBound = true;
} else if (!locBound) {
startService(new Intent(this, MainService.class));
getApplicationContext().bindService(new Intent(getApplicationContext(), MainService.class), mConnection, Context.BIND_AUTO_CREATE);
}
setContentView(R.layout.activity_line);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.hide();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
lineIconsLayout = (LinearLayout) findViewById(R.id.line_icons_layout);
disturbancesWarningLayout = (LinearLayout) findViewById(R.id.disturbances_warning_layout);
lineLayout = (LinearLayout) findViewById(R.id.line_layout);
}
示例14: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
LogUtils.d("dy:" + dyConsumed +" -- dyu:" + dyUnconsumed);
if(dyConsumed>0 && child.getVisibility() == View.VISIBLE){
// child.startAnimation(AnimationUtils.loadAnimation(context, R.anim.fab_behavior_out));
child.hide();
}else if(dyConsumed<0 && child.getVisibility() != View.VISIBLE){
// child.startAnimation(AnimationUtils.loadAnimation(context, R.anim.fab_behavior_in));
child.show();
}
}
示例15: updateFab
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
/**
*
*/
private void updateFab() {
FloatingActionButton fab = findViewById(R.id.addDeviceFab);
if (pendingDevices.isEmpty()) {
fab.hide();
} else {
fab.show();
}
}