当前位置: 首页>>代码示例>>Java>>正文


Java FloatingActionButton类代码示例

本文整理汇总了Java中android.support.design.widget.FloatingActionButton的典型用法代码示例。如果您正苦于以下问题:Java FloatingActionButton类的具体用法?Java FloatingActionButton怎么用?Java FloatingActionButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FloatingActionButton类属于android.support.design.widget包,在下文中一共展示了FloatingActionButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar.setTitle("");
    mItemDescription = (TextView) findViewById(R.id.text_view_item_description);
    mItemPrice = (TextView) findViewById(R.id.text_view_item_price);
    final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);

    setSupportActionBar(mToolbar);
    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) {
        supportActionBar.setDisplayHomeAsUpEnabled(true);
    }
    fab.setOnClickListener(this);

    mItemId = getIntent().getIntExtra(INTENT_EXTRA_ITEM, 0);

    getSupportLoaderManager().initLoader(PLANT_DETAIL_LOADER, null, this);
}
 
开发者ID:laramartin,项目名称:android_firebase_green_thumb,代码行数:23,代码来源:PlantDetailActivity.java

示例2: initButtons

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
private void initButtons(@NonNull Context context, @NonNull List<Integer> icons, @NonNull List<Integer> colors) {
    final int buttonsCount = Math.min(icons.size(), colors.size());
    for (int i = 0; i < buttonsCount; i++) {
        final FloatingActionButton button = new FloatingActionButton(context);
        button.setImageResource(icons.get(i));
        button.setBackgroundTintList(ColorStateList.valueOf(colors.get(i)));
        button.setClickable(true);
        button.setOnClickListener(new OnButtonClickListener());
        button.setOnLongClickListener(new OnButtonLongClickListener());
        button.setScaleX(0);
        button.setScaleY(0);
        button.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

        addView(button);
        mButtons.add(button);
    }
}
 
开发者ID:Ramotion,项目名称:circle-menu-android,代码行数:18,代码来源:CircleMenuView.java

示例3: onCreate

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);


    go = (Button) findViewById(R.id.button2);
    go.setOnClickListener(btGo);
    location = (EditText) findViewById(R.id.editLocation);
    progressBarSubject = (ProgressBar) findViewById(R.id.progressBar);
    SubjectListView = (ListView) findViewById(R.id.listview1);
    trendingBtm = (ImageButton) findViewById(R.id.imageBtmtrending);
    userBtm = (ImageButton) findViewById(R.id.imageBtmuser);
    locationBtm = (ImageButton) findViewById(R.id.imageBtmlocation);
    settingsBtm = (ImageButton) findViewById(R.id.imageBtmSettings);
    addReviewBtm = (FloatingActionButton) findViewById(R.id.addReview);
    trendingBtm.setOnClickListener(btTrending);
    userBtm.setOnClickListener(btUser);
    locationBtm.setOnClickListener(btlocation);
    settingsBtm.setOnClickListener(btSettings);
    addReviewBtm.setOnClickListener(btAdd);


}
 
开发者ID:cdc03819,项目名称:BrewBook,代码行数:25,代码来源:MapsActivity.java

示例4: onCreate

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_navigation_menu);
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });

    final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    final ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close
    );

    drawer.addDrawerListener(toggle);
    toggle.syncState();
    drawer.openDrawer(Gravity.START);
}
 
开发者ID:PacktPublishing,项目名称:Hands-On-Android-UI-Development,代码行数:26,代码来源:NavigationMenuActivity.java

示例5: onCreate

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    setTitle("HomeAssist Control Builder");

    mDataTextView = findViewById(R.id.text_data);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showEntityAction();
        }
    });
}
 
开发者ID:axzae,项目名称:homeassist-builder,代码行数:18,代码来源:MainActivity.java

示例6: onCreate

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.chat_activity_register);
    fab = (FloatingActionButton) findViewById(R.id.fab);
    cvAdd = (CardView) findViewById(R.id.cv_add);
    editTextUsername = (EditText) findViewById(R.id.et_username);
    editTextPassword = (EditText) findViewById(R.id.et_password);
    editTextRepeatPassword = (EditText) findViewById(R.id.et_repeatpassword);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ShowEnterAnimation();
    }
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            animateRevealClose();
        }
    });
}
 
开发者ID:ansarisufiyan777,项目名称:Show_Chat,代码行数:20,代码来源:RegisterActivity.java

示例7: findView

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
private void findView() {
    rvRing =(RecyclerViewPager)findViewById(R.id.rv_ring);
    svContainer = (ObservableScrollView) findViewById(R.id.sv_container);
    svDetail = (ScrollView) findViewById(R.id.sv_detail);
    blurringView = (BlurringView) findViewById(R.id.blurring);
    vpModel = (JazzyViewPager) findViewById(R.id.vp_model);
    ivBlur = (ImageView) findViewById(R.id.iv_blur);
    tvName = (TextView) findViewById(R.id.tv_name);

    floatingActionButton = (FloatingActionButton)findViewById(R.id.fab);
    layoutContainer = (RelativeLayout) findViewById(R.id.layout_container);
    layoutFakeRipple = (RelativeLayout) findViewById(R.id.layout_fake_ripple);
    rvCheckOut = (RecyclerView) findViewById(R.id.rv_check_out);
    tvTitle = (TextView) findViewById(R.id.tv_title);
    btnPay = (MorphingButton) findViewById(R.id.btn_pay);
}
 
开发者ID:SimonCherryGZ,项目名称:JewelryUI,代码行数:17,代码来源:MainActivity.java

示例8: 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);

    //child -> Floating Action Button
    if (dyConsumed > 0) {
        Log.d("Scrolling", "Up");
        CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
        int fab_bottomMargin = layoutParams.bottomMargin;
        child.animate().translationY(child.getHeight() + fab_bottomMargin).setInterpolator(new LinearInterpolator()).start();
    } else if (dyConsumed < 0) {
        Log.d("Scrolling", "down");
        child.animate().translationY(0).setInterpolator(new LinearInterpolator()).start();
    }
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:22,代码来源:ScrollAwareFABBehavior.java

示例9: onCreateView

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    view = inflater.inflate(R.layout.fragment_task_list, container, false);

    mTextEmptyList = (TextView) view.findViewById(R.id.text_empty_list);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView_main);
    mFab = (FloatingActionButton) view.findViewById(R.id.fab_add);

    mLayoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(mLayoutManager);
    RecyclerView.ItemDecoration itemDecoration = new
            DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL);
    mRecyclerView.addItemDecoration(itemDecoration);

    setClickListeners();
    setupBroadcastReceiver();

    return view;
}
 
开发者ID:swapyx,项目名称:Channelize,代码行数:24,代码来源:TaskListFragment.java

示例10: onCreate

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.activity_edit);
    textfield = (EditText) findViewById(R.id.input_name);
    handler = new DBHandler(this);
    db = handler.getWritableDatabase();

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            openAlarmEdit(view);
            save(null);
        }
    });

    if(getIntent().getExtras() != null) {
        index = getIntent().getExtras().getInt("index");
    }
}
 
开发者ID:CentriaUniversityOfAppliedSciences,项目名称:Android_RuuvitagScannner,代码行数:22,代码来源:EditActivity.java

示例11: onCreate

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_cliente);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    editNome = (EditText) findViewById(R.id.editNome);
    editTelefone = (EditText) findViewById(R.id.editTelefone);
    editEndereco = (EditText) findViewById(R.id.editEndereco);
    editEmail = (EditText) findViewById(R.id.editEmail);

    fab = (FloatingActionButton) findViewById(R.id.btnConfirmAddCliente);

    dbConnection = new DBConnection();
    dbConnection.createConnection(this);

}
 
开发者ID:victorvgc,项目名称:natumassas-app,代码行数:19,代码来源:AddCliente.java

示例12: setupView

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
/**
 * Setup {@link PoiListFragment} static views and their click listeners
 */
private void setupView() {
    TextView osmCopyright = (TextView) getActivity().findViewById(R.id.osmCopyright);
    osmCopyright.setText(Html.fromHtml(getString(R.string.osm_copyright)));

    relativeLayout = (RelativeLayout) getActivity().findViewById(R.id.mapViewPoiListContainer);
    floatingActionButton = (FloatingActionButton) getActivity().findViewById(R.id.fabPoiList);
    floatingActionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (!mapPreviewVisible) {
                floatingActionButton.setImageResource(R.drawable.ic_close_white);
                relativeLayout.setVisibility(View.VISIBLE);
                mapPreviewVisible = true;
            } else {
                floatingActionButton.setImageResource(R.drawable.ic_map_white);
                relativeLayout.setVisibility(View.GONE);
                mapPreviewVisible = false;
            }
        }
    });
}
 
开发者ID:CityZenApp,项目名称:Android-Development,代码行数:25,代码来源:PoiListFragment.java

示例13: onCreate

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample_report);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });
}
 
开发者ID:plasmalaser,项目名称:TeamCSSS-Enactus,代码行数:17,代码来源:sampleReport.java

示例14: onCreate

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_second);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });
}
 
开发者ID:poorya-abbasi,项目名称:Gonnect,代码行数:17,代码来源:SecondActivity.java

示例15: init

import android.support.design.widget.FloatingActionButton; //导入依赖的package包/类
private void init(Context context, AttributeSet attributeSet) {
    this.model = new ButterflyModel(context);
    View root = inflate(context, R.layout.domlayout, this);
    this.screenMetrics = context.getResources().getDisplayMetrics();
    this.floatingActionButton = (FloatingActionButton) root.findViewById(R.id.fab);
    this.floatingActionButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (model.isOpened()) {
                closeBubble();
            } else {
                openBubble();
            }
        }
    });
    if (attributeSet != null)
        applyStyling(context.obtainStyledAttributes(attributeSet, R.styleable.ButterflyButton));
    setMinimumWidth((int) this.model.getMaxRadius());
    setMinimumHeight((int) this.model.getMaxRadius());
}
 
开发者ID:TheKevin1512,项目名称:ButterflyButton,代码行数:21,代码来源:ButterflyButton.java


注:本文中的android.support.design.widget.FloatingActionButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。