'android'에 해당되는 글 78건

  1. 2014.06.26 Android: Use a custom font everywhere
  2. 2014.06.26 HzGrapher
  3. 2014.06.26 Pull To Refresh
  4. 2014.06.26 View Badger
  5. 2014.06.26 IndexableListView
  6. 2014.06.26 Android Coverflow
  7. 2014.06.26 Wheel Widget
  8. 2014.06.26 AndroidDrawer
  9. 2014.06.26 Radial Menu Widget
  10. 2014.06.26 Swipe-To-Dismiss
android2014.06.26 13:42

The View Crawler

Layouts (and sub-layouts) in Android are tree hierarchies comprised of ViewGroups as composite elements and Views as leaf nodes. This tree can be crawled by visiting child views in your favorite order (breadth first or depth first). When crawling this tree, one can replace all the Typefaces on any TextViews, EditTexts, and Buttons that are encountered.

Here is a simple recursive implementation of a view crawler that will replace theTypeface for any appropriate view in the hierarchy:

public class FontChangeCrawler
    private Typeface typeface;

    public FontChangeCrawler(Typeface typeface)
        this.typeface = typeface;

    public FontChangeCrawler(AssetManager assets, String assetsFontFileName)
        typeface = Typeface.createFromAsset(assets, assetsFontFileName);

    public void replaceFonts(ViewGroup viewTree)
        View child;
        for(int i = 0; i < viewTree.getChildCount(); ++i)
            child = viewTree.getChildAt(i);
            if(child instanceof ViewGroup)
                // recursive call
            else if(child instanceof TextView)
                // base case
                ((TextView) child).setTypeface(typeface);

Replace Entire Activity's Typeface

To replace the default font in every view within an Activity's layout, simply use theFontChangeCrawler from above, like so:

public void setContentView(View view)

    FontChangeCrawler fontChanger = new FontChangeCrawler(getAssets(), "font.otf");

If you are not familiar with android.R.id.content, it is the official ID given to the rootView within an Activity's layout.

Consider placing the above logic in a BaseActivity class.

Replace Fragment's Typeface

You will need to apply the FontChangeCrawler to each Fragment as well. Consider placing this logic in a BaseFragment class.

public void onActivityCreated(Bundle savedInstanceState)

    FontChangeCrawler fontChanger = new FontChangeCrawler(getAssets(), "font.otf");
    fontChanger.replaceFonts((ViewGroup) this.getView());

Handle Adapters, etc.

Replacing Activity fonts goes a long way, but most of us also have a plethora ofListViews. The list items in a ListView are built within an adapter, not within an Activity. Therefore, you will also need to use the FontChangeCrawler in your adapters:

if(convertView == null)
    convertView = inflater.inflate(R.layout.listitem, null);

What's Not Handled?

I will leave handling the ActionBar as an exercise for the reader. Also, consider how you might handle widgets whose typeface you don't want to change.

Posted by 레드오이
android2014.06.26 11:24


android hz graph library


  • Line Graph Screenshot

  • Line Graph with Region Screenshot


Posted by 레드오이
android2014.06.26 10:56
25 October

Pull To Refresh

By Chris Banes

This project aims to provide a reusable Pull to Refresh widget for Android. It was originally based on Johan Nilsson’s library (mainly for graphics, strings and animations), but these have been replaced since.


  • Supports both Pulling Down from the top, and Pulling Up from the bottom (or even both).
  • Animated Scrolling for all devices.
  • Over Scroll supports for devices on Android v2.3+.
  • Currently works with ListViewExpandableListView & GridViewWebView and ScrollView!
  • Integrated End of List Listener for use of detecting when the user has scrolled to the bottom.
  • Maven Support.
  • Indicators to show the user when a Pull-to-Refresh is available.
  • Support for ListFragment!
  • Lots of Customisation options!


Posted by 레드오이
android2014.06.26 10:55

View Badger

By Jeff Gilfelt

A simple way to “badge” any given Android view at runtime without having to cater for it in layout.

Download: GitHub


Posted by 레드오이
android2014.06.26 10:55
23 October


By Daniel Nam

iPhone like fast scroll ListView on Android.


Posted by 레드오이
android2014.06.26 10:54

Android Coverflow

A simple implementation of coverflow for Android. It is largely based on code example written byNeil Davies.

The Coverflow view works pretty much like the standard Android Gallery widget, but with the addition of the rotation of the images.


Posted by 레드오이
android2014.06.26 10:54

Wheel Widget

The Wheel Widget by Yuri Kanivets is supposed to serve as Android’s equivalent to the iOS’UIPickerView.

The library features a few examples, such as Country/City selection, Date and Time selection.

Download: Google Code


Posted by 레드오이
android2014.06.26 10:53


By Łukasz Milewski

A simple but powerful menu drawer implementation. A lot of functionally are based on very good article by Cyril Mottier and Facebook mobile application.

You don’t need to extend yet another Activity implementation, this simplify integration with bigger applications.


Posted by 레드오이
android2014.06.26 10:52

Radial Menu Widget

By Arindam Nath

A radial menu widget released in this tumblr post.


Posted by 레드오이
android2014.06.26 10:52


by .

This is Android 4.0 style Swipe-To-Dismiss implementation.
The implementation works on vertical LinearLayouts and ListViews as well, and should imitate the behaviour of Android 4.0+ app switcher.

Download: GitHub


Posted by 레드오이