Langsung ke konten utama

Postingan

Menampilkan postingan dengan label layouts

Tutorial: Flexible Space With Image Action Bar

Android Support Library Android Support Library provides many useful features for android developers and doing it with backward-compatibility in mind. Watch this video where Ian Lake explain why it's so good ( it's just me or his smile looks terrifying? Leave your thoughts in the comment section). As you may guess we'll use design part of this library, actually a small part of the design part. To be able to use it in your project you should add a gradle dependency. compile 'com.android.support:design:23.3.0' Flexible Space With Image is a scrolling technique that was presented as a part of the material design and Android Support Design Library makes it really easy to implement one and also makes it backward-compatible so you don't need to write a code mess to support it on each API. We can achieve this effect with very small amount of java code using XML primarily. We’ll use CoordinatorLayout , AppBarLayout , and CollapsingToolbarLayout . CoordinatorLayout a...

Tutorial: Android ListView With Custom Adapter

There are so many apps utilizing ListView in Android. Your feed in a social network, your tasks in a to-do app, even your mail in your favorite email app stored in a ListView. Basically, ListView is a container for a collection of items that can be represented as an array. You should be able to get any item from a collection by its index and get the size of an underlying collection. Also, it would be nice to be able to add new elements to your collection unless you want it to be constant. In my opinion, ArrayList  fits this definition perfectly. In ArrayAdapter , they use List as an underlying collection, though, but in some implementations of it ( LinkedList  for example) get operation is linear of index you pass to it, so it can be bad for performance. But it's not a reason to reject ArrayAdapter, just be careful with what implementation you pass to it. Custom List Adapter ArrayAdapter by default adapts only strings to TextViews, but we want someth...