當前位置: 首頁>>代碼示例>>Java>>正文


Java FloatingActionButton類代碼示例

本文整理匯總了Java中com.melnykov.fab.FloatingActionButton的典型用法代碼示例。如果您正苦於以下問題:Java FloatingActionButton類的具體用法?Java FloatingActionButton怎麽用?Java FloatingActionButton使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FloatingActionButton類屬於com.melnykov.fab包,在下文中一共展示了FloatingActionButton類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUpFAB

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
/**
 * Setup utility for the FAB
 *
 * @param context
 * @param icon         the icon to apply
 * @param button       the FAB button
 * @param mFABlistener the listener to apply
 */
public static void setUpFAB(Activity context, int icon, FloatingActionButton button, View.OnClickListener mFABlistener) {
    button.setVisibility(View.VISIBLE);
    button.setType(FloatingActionButton.TYPE_NORMAL);
    if (ThemeUtils.getAppTheme3(context) < 6) {
        button.setColorNormal(context.getResources().getColor(
                ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context)));
        button.setColorPressed(context.getResources().getColor(
                ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context)));
    } else {
        button.setColorNormal(ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context));
        button.setColorPressed(ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context));
    }
    button.setImageDrawable(context.getResources().getDrawable(icon));
    button.setOnClickListener(mFABlistener);
}
 
開發者ID:89luca89,項目名稱:ThunderMusic,代碼行數:24,代碼來源:InterfaceUtils.java

示例2: onResume

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
public void onResume() {
    super.onResume();

    listView = (ListView) findViewById(R.id.list_view);
    bartoursAdapter = new BartoursAdapter(
            this,
            bartout.getBartours()
    );
    listView.setAdapter(bartoursAdapter);

    listView.setOnItemClickListener(this);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.newBartourButton);
    fab.attachToListView(listView);

    if(bartout.getActiveBartour() != null) {
        fab.setColorNormal(Color.GRAY);
        fab.setColorPressed(Color.GRAY);
        fab.setColorRipple(Color.GRAY);
    } else {
        fab.setColorNormal(Color.parseColor("#4CAF50"));
        fab.setColorPressed(Color.parseColor("#2E7D32"));
        fab.setColorRipple(Color.parseColor("#43A047"));
    }
}
 
開發者ID:Bartout-Team,項目名稱:Bartout,代碼行數:26,代碼來源:HomeActivity.java

示例3: onCreateView

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(
            R.layout.fragment_recyclerview, container, false);

    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroller);
    FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
    fab.hide();
    ImageView backdrop = (ImageView) rootView.findViewById(R.id.white_backdrop);
    backdrop.setVisibility(View.VISIBLE);

    setLayoutManager();

    if (getActivity() != null)
        new loadAlbums().execute("");
    return rootView;
}
 
開發者ID:rohanoid5,項目名稱:Muzesto,代碼行數:19,代碼來源:AlbumFragment.java

示例4: onCreateView

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(
            R.layout.fragment_recyclerview, container, false);

    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroller);
    FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
    fab.hide();
    ImageView backdrop = (ImageView) rootView.findViewById(R.id.white_backdrop);
    backdrop.setVisibility(View.VISIBLE);

    //audioVisualization = (AudioVisualization) rootView.findViewById(R.id.visualizer_view);

    setLayoutManager();

    if (getActivity() != null)
        new loadArtists().execute("");
    return rootView;
}
 
開發者ID:rohanoid5,項目名稱:Muzesto,代碼行數:21,代碼來源:ArtistFragment.java

示例5: generateFollowCircles

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
private ArrayList<ImageButton> generateFollowCircles() {

        int diameter = mFAB.getType() == FloatingActionButton.TYPE_NORMAL ?
                Utils.getDimension(mContext, R.dimen.fab_size_normal) :
                Utils.getDimension(mContext, R.dimen.fab_size_mini);

        ArrayList<ImageButton> circles = new ArrayList<>(mMenuItems.size());
        for (MenuItem item : mMenuItems) {
            ImageButton circle = new ImageButton(mContext);
            OvalShape ovalShape = new OvalShape();
            ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape);
            shapeDrawable.getPaint().setColor(getResources().getColor(item.getBgColor()));
            circle.setBackgroundDrawable(shapeDrawable);
            circle.setImageResource(item.getIcon());
            LayoutParams lp = new LayoutParams(diameter, diameter);
            circle.setLayoutParams(lp);
            circles.add(circle);
        }

        return circles;
    }
 
開發者ID:tiancaiCC,項目名稱:SpringFloatingActionMenu,代碼行數:22,代碼來源:SpringFloatingActionMenu.java

示例6: generateRevealCircle

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
private View generateRevealCircle() {
    int diameter = mFAB.getType() == FloatingActionButton.TYPE_NORMAL ?
            Utils.getDimension(mContext, R.dimen.fab_size_normal) :
            Utils.getDimension(mContext, R.dimen.fab_size_mini);
    View view = new View(mContext);
    OvalShape ovalShape = new OvalShape();
    ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape);
    shapeDrawable.getPaint().setColor(ContextCompat.getColor(mContext, mRevealColor));
    view.setBackgroundDrawable(shapeDrawable);
    LayoutParams lp = new LayoutParams(diameter, diameter);
    view.setLayoutParams(lp);

    // Make view clickable to avoid clicks on any view located behind the menu
    view.setClickable(true);

    // note it is invisible, but will be visible while  animating
    view.setVisibility(View.INVISIBLE);
    return view;
}
 
開發者ID:tiancaiCC,項目名稱:SpringFloatingActionMenu,代碼行數:20,代碼來源:SpringFloatingActionMenu.java

示例7: onViewCreated

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.inject(this, view);

    mSwipeRefresh.setOnRefreshListener(this);
    mSwipeRefresh.setColorSchemeResources(getFragmentActivity().isEasyRedmine() ? R.color.er_primary : R.color.r_primary);

    if (!mLastFilter.equals(Storage.getFilter()) || mAdapter == null) {
        setFilteredAdapter(!mLastFilter.equals(Storage.getFilter()));
    }

    FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);
    fab.attachToListView(getListView());
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            NewTaskActivity.start(getFragmentActivity());
        }
    });
}
 
開發者ID:easyredmine,項目名稱:mobile_app_android,代碼行數:22,代碼來源:TasksFragment.java

示例8: addHelperFab

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
public void addHelperFab(Context context ,HelperFab.Location location,final HelperFab fab) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
    final FloatingActionButton newFab = (FloatingActionButton)inflater.inflate(R.layout.fab_layout_normal,null);
    newFab.setBackgroundColor(fab.getBackgroundColor());
    newFab.setColorNormal(fab.getBackgroundColor());
    newFab.setColorPressed(fab.getFabSelectedColor());
    newFab.setColorRipple(fab.getFabRippleColor());
    newFab.setImageDrawable(fab.getDrawable());
    newFab.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            fab.onClick();
        }
    });

    if(location == HelperFab.Location.RIGHT) {
        helperFabRight = newFab;
    }
    else if(location == HelperFab.Location.LEFT) {
        helperFabLeft = newFab;
    }
}
 
開發者ID:oznakn,項目名稱:HorizontalFabMenu,代碼行數:24,代碼來源:HorizontalFabMenu.java

示例9: onCreateView

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment and hold the reference
    //in mRootView
    mRootView = inflater.inflate(R.layout.fragment_note_list, container, false);

    //Get a programmatic reference to the Floating Action Button
    mFab = (FloatingActionButton)mRootView.findViewById(R.id.fab);

    //attach an onClick listener to the Floating Action Button
    mFab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(getActivity(), NoteEditorActivity.class));
        }
    });

    setupList();
    return mRootView;
}
 
開發者ID:Okason,項目名稱:SimpleNoteApp,代碼行數:22,代碼來源:NoteListFragment.java

示例10: onCreate

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTheme(R.style.down_up_theme);
    setContentView(R.layout.activity_wishlist);
    myTitle = getString(R.string.app_name);
    if (toolbar == null) {
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        if (toolbar != null) {
            setSupportActionBar(toolbar);
            toolbar.setTitle(myTitle);
            toolbar.setTitleTextColor(getResources().getColor(android.R.color.white));
            getSupportActionBar().setDisplayShowTitleEnabled(true);
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
    }

    RecyclerView recyclerView = (RecyclerView) findViewById(
            R.id.wishlist_recyclerview);
    recyclerView.setHasFixedSize(true);
    recyclerView.setAdapter(new NumberedAdapter(30));

    FloatingActionButton wishlistFab = (FloatingActionButton) findViewById(R.id.wishlist_fab);
    wishlistFab.attachToRecyclerView(recyclerView);

}
 
開發者ID:championswimmer,項目名稱:Bookd_Android_App,代碼行數:27,代碼來源:WishlistActivity.java

示例11: onCreate

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_book_library);

    addBookContainer = (ObservableScrollView) findViewById(R.id.add_book_container);

    imageBook = (SimpleDraweeView) findViewById(R.id.image_book);
    tvBookTitle = (TextView) findViewById(R.id.tv_book_title);
    tvBookAuthor = (TextView) findViewById(R.id.tv_book_author);
    tvBookPublisher = (TextView) findViewById(R.id.tv_book_publisher);
    tvBookSummary = (TextView) findViewById(R.id.tv_book_summary);
    addLibraryButton = (FloatingActionButton) findViewById(R.id.btn_addlibrary);

    addLibraryButton.attachToScrollView(addBookContainer);

    Intent scan = new Intent(this, ScannerActivity.class);
    startActivityForResult(scan, ADD_BOOK_LIBRARY_RESULT);
}
 
開發者ID:championswimmer,項目名稱:Bookd_Android_App,代碼行數:20,代碼來源:AddBookLibraryActivity.java

示例12: onCreate

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    DetectWear.setNodesListener(this);

    sharedPreferences = this.getSharedPreferences("pl.tajchert.spritzerwear", Context.MODE_PRIVATE);

    commentsRecList = (RecyclerView) findViewById(R.id.storyList);
    fab = (FloatingActionButton) findViewById(R.id.normal_plus);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showAddDialog();
        }
    });

    commentsRecList.setHasFixedSize(false);
    LinearLayoutManager llm = new LinearLayoutManager(this);
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    commentsRecList.setLayoutManager(llm);
    arrayListStories = new ArrayList<>();
    adapter = new AdapterComment(arrayListStories);
    commentsRecList.setAdapter(adapter);

}
 
開發者ID:tajchert,項目名稱:SpritzerWear,代碼行數:27,代碼來源:MainActivity.java

示例13: hideShowViewByScale

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
public static void hideShowViewByScale(final View view, final int icon) {

        ViewPropertyAnimator propertyAnimator = view.animate().setStartDelay(SCALE_FACTOR)
                .scaleX(0).scaleY(0);

        propertyAnimator.setDuration(300);
        propertyAnimator.start();

        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            public void run() {
                ((FloatingActionButton) view).setImageResource(icon);
                showViewByScale(view);
            }
        }, 300);

    }
 
開發者ID:yeloapp,項目名稱:yelo-android,代碼行數:18,代碼來源:Utils.java

示例14: onCreate

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(R.string.main_title);
    setContentView(R.layout.activity_conversations_list);

    ArrayList<Conversation> conversations = Utils.loadConversationsFromCache(getBaseContext());
    if(conversations == null) conversations = new ArrayList<>();

    listAdapter = new ConversationsListAdapter(getBaseContext(),
            R.layout.conversation_item, conversations);

    mListView = (ListView) findViewById(R.id.conversations_list_view);
    mListView.setAdapter(listAdapter);
    // Listen to clicks
    mListView.setOnItemClickListener(this);
    // listen for conversation updates
    initMultiChoiceListView();

    fab = (FloatingActionButton) findViewById(R.id.fab);
    getLoaderManager().initLoader(0, null, this);
}
 
開發者ID:Ioane5,項目名稱:GeoSMS-Release,代碼行數:23,代碼來源:ConversationsListActivity.java

示例15: onCreate

import com.melnykov.fab.FloatingActionButton; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mToolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
    mToolbar.setTitle(R.string.app_name);
    setSupportActionBar(mToolbar);

    mCurrentPageId = PAGE_ID_COLOR_ITEM_LIST;
    mColorItemListPage = new ColorItemListPage(this);
    mColorItemListPage.setListener(this);
    mPaletteListPage = new PaletteListPage(this);
    mPaletteListPage.setListener(this);

    mFab = (FloatingActionButton) findViewById(R.id.activity_main_fab);
    mFab.setOnClickListener(this);

    final MyPagerAdapter adapter = new MyPagerAdapter();
    mTabs = (PagerSlidingTabStrip) findViewById(R.id.activity_main_tabs);
    mViewPager = (ViewPager) findViewById(R.id.activity_main_view_pager);
    mViewPager.setAdapter(adapter);
    mTabs.setViewPager(mViewPager);
    mTabs.setOnPageChangeListener(this);

    mMainActivityFlavor = new MainActivityFlavor(this);
}
 
開發者ID:tvbarthel,項目名稱:CameraColorPicker,代碼行數:27,代碼來源:MainActivity.java


注:本文中的com.melnykov.fab.FloatingActionButton類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。