Tag: android-layout

How to inflate one view with a layout

I have a layout defined in XML. It contains also: <RelativeLayout android:id=”@+id/item” android:layout_width=”fill_parent” android:layout_height=”wrap_content” /> I would like to inflate this RelativeView with other XML layout file. I may use different layouts depending on a situation. How should I do it? I was trying different variations of RelativeLayout item = (RelativeLayout) findViewById(R.id.item); item.inflate(…) But none […]

How to animate RecyclerView items when they appear

How can I animate the RecyclerViews when there are appearing? The default item animator only animates when a data is added or removed after the recycler data has been set. I’m new developing applications, and don’t have any clue where to start. Any ideas how to achieve this?

Android list view inside a scroll view

I have an android layout which has a scrollView with a number of elements with in it. At the bottom of the scrollView I have a listView which is then populated by an adapter. The problem that I am experiencing, is that android is excluding the listView from the scrollView as the scrollView already has […]

Custom attributes in styles.xml

I have created a custom widget, and I’m declaring it in layout.xml. I have also added some custom attributes in attr.xml. However, when trying to declare these attributes in a style in styles.xml, it’s giving me No resource found that matches the given name: attr ‘custom:attribute’. I have put the xmlns:custom=”http://schemas.android.com/apk/res/com.my.package” in all of the […]

Setting background colour of Android layout element

I am trying to, somewhat clone the design of an activity from a set of slides on Android UI design. However I am having a problem with a very simple task. I have created the layout as shown in the image, and the header is a TextView in a RelativeLayout. Now I wish to change […]

Flinging with RecyclerView + AppBarLayout

I am using the new CoordinatorLayout with AppBarLayout and CollapsingToolbarLayout. Below AppBarLayout, I have a RecyclerView with a list of content. I have verified that fling scrolling works on the RecyclerView when I am scrolling up and down the list. However, I would also like the AppBarLayout to smoothly scroll during expansion. When scrolling up […]

How can you tell when a layout has been drawn?

I have a custom view that draws a scrollable bitmap to the screen. In order to initialize it, i need to pass in the size in pixels of the parent layout object. But during the onCreate and onResume functions, the Layout has not been drawn yet, and so layout.getMeasuredHeight() returns 0. As a workaround, i […]

How to display count of notifications in app launcher icon

samsung galaxy note 2 android version 4.1.2 I know that this question was asked before and the reply was not possible How to display balloon counter over application launcher icon on android Nevertheless yesterday I updated the facebook app and it started to show a counter of unread messages private messages. How come facebook app […]

Avoid passing null as the view root (need to resolve layout parameters on the inflated layout's root element)

Passing null for root studio gives me this warning: Avoid passing null as the view root (need to resolve layout parameters on the inflated layout’s root element) It is showing a null value in getGroupView. Please help. public class ExpandableListAdapter extends BaseExpandableListAdapter { private Context _context; private List<String> _listDataHeader; // header titles // child data […]

How to build a Horizontal ListView with RecyclerView?

I need to implement a horizontal listview in my Android application. I did a bit of research and came across How can I make a horizontal ListView in Android? and Horizontal ListView in Android? however, these questions were asked before Recyclerview was released. Is there a better way to implement this now with Recyclerview?

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.