Code Monkey home page Code Monkey logo

thumbnailmenu's Introduction

ThumbnailMenu

这是一个简单而精致的 Fragment 菜单控件,它可以让你切换 Fragment 的时候不再单调、死板。

Preview



Usage

导入 tmlibrary module, 或者直接拷贝 com.hitomi.tmlibrary 包下所有 java 文件到您的项目中

布局文件中:

<com.hitomi.tmlibrary.ThumbnailMenu
    android:id="@+id/thumb"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:menu_direction="right">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@mipmap/profile_background">

    </RelativeLayout>

</com.hitomi.tmlibrary.ThumbnailMenu>

RelativeLayout 可以让您编写自己的背景布局

Activity 中:

Fragment1 fragment1 = new Fragment1();
Fragment2 fragment2 = new Fragment2();
Fragment3 fragment3 = new Fragment3();
Fragment4 fragment4 = new Fragment4();
Fragment5 fragment5 = new Fragment5();

fragmentList.add(fragment5);
fragmentList.add(fragment4);
fragmentList.add(fragment3);
fragmentList.add(fragment2);
fragmentList.add(fragment1);

FragmentPagerAdapter adapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

};
thumMenu.setAdapter(adapter);

Attributes

<attr name="menu_direction" format="enum">
    <enum name="left" value="1000" />
    <enum name="bottom" value="1001" />
    <enum name="right" value="1002" />
</attr>
支持三种方向:
    left :缩略图置于屏幕左侧
    bottom : 缩略图置于屏幕底部
    right : 缩略图置于屏幕右侧

<attr name="scale_ratio" format="float" />
支持缩略图大小自定义
    scale_ratio :取值为 0.1f 到 1.0f 之间。

#Licence

MIT

thumbnailmenu's People

Contributors

hitomis avatar

Watchers

Charles.pan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.