All snippets tagged with android

Page 2 of 7
 

A View that shows a vertical, dotted line

Various Square- or Fixed-ratio layouts and views

Progress bar masked by text

View with a hook to add draw operations

This view allows draw operations to be executed in a different class. This makes it easier to draw onto a canvas without having to create a custom view for every different use case.

Read more…

GIF compatible EditText

Pie chart-like progress bar

This custom view shows a clock-like circular countdown, and can be used as a timer or as a ProgressBar. To use as a timer, create your own handler (or similar) to update the progress automatically.

Read more…

Using <ul> in TextViews

Underline text in a view

There’s no textStyle to add underline to a TextView or Button. Use the following to add it programmatically instead:

Read more…

All the adjustments to get a completely transparent statusbar

First, edit the themes. This is an example to use for your Activity in the default styles.xml:

Read more…

Take a screenshot of a view

These snippets allows grabbing a screenshot of a View or Activity as a bitmap. There are special version to make this work on SurfaceViews and TextureViews.

Read more…

Shrinkin/growing ViewPager

When iOS-ifying a ViewPager, it is often needed to animate the pages when they come into view. The following snippet shrinks the offscreen pages a little bit, and grows them to regular size when swiping them to the center of the display.

Read more…

Getting the screen size in pixels

Start by getting a reference to the WindowManager. When in an Activity, you can use getWindowManager(), otherwise, use:

Read more…

Bottom-to-top chat-style reversed RecyclerView

RecyclerView with CursorAdapter and reordering

This is a combination of a CursorAdapter fit for RecyclerViews, and several helpers to support drag-and-drop and swipe-to-dismiss.

Read more…

Using a RecyclerView