Tag: android-layout

How to get the ID of the clicked child view added dynamically to a LinearLayout?

I am adding a child view to a Linear Layout. The child views itself has some textview and imageviews in a Relativelayout. The child view is added dynamically in the LinearLayout on clicking a button. Right now I am able to add the child view as shown in this pic. http://dl.dropbox.com/u/50249620/SC20120926-031356.png what I have to […]

Why don't some xhdpi mobiles display image located in /res/drawable only?

This is a scenario. There are folders: drawable drawable-ldpi drawable-mdpi drawable-hdpi draawble-xhdpi An image (usually background, but not bound to such images only) is located in /res/drawable only. I test the app on Galaxy S3 and the background is displayed properly. I test on HTC One X and background image is not being displayed. If […]

Layout like Cards in android

I want to make an android layout like Google Cards,i know there is an Open Source Libraries, however i want only the Layout and the gray hex background style. I could not find information about this, how i can make this possible? im Attaching new Google maps v7 Layout so you can get the idea.

How to make Activity, not covering full screen

I want my activity to take smaller area of the screen e.g. toast doesn’t cover all of the screen, it is just shown over other things and rest of the contents can be seen behind the toast. But it’s a dialog, and I want my screen to be shown above other things e.g. above Home […]

Tiled background is pushing it's View size

I have a tiled bitmap that I’m using as the View background. This View, let’s say, has android:layout_height=”wrap_content”. The problem is that the height of the bitmap used in the background is participating in the measurement of the view, increasing the View height. This can be noticed when the size of the content of View […]

How do I make it only landscape for tablets and only portrait for phones?

how can it so that when a tablet is running the application, it is forced to run it in landscape and when a phone is running the application, it is forced to run it in portrait? I’ve managed to force it to run in lets say portrait, but then it run portrait for tablets too… […]

When are child views added to Layout/ViewGroup from XML

My question is : I want to know when does a xLayout (or ViewGroup in general) add a child view from XML ? And by “when” I mean at what point of code, in what “pass” of the “traversal” of the UI toolkit ? Which method of xLayout or ViewGroup should I override ? I […]

How to vertically align text in a TextView with Compound Drawable

This question is in a way a continuation of my last question. My problem now is pretty much the same, except that instead of separating the image and text in differend views (namely ImageView and TextView) I learned I can use the attribute android:drawableLeft to set an image “for” my text (the suggestion was pointed […]

How to create a custom LayoutParams to be used on a custom layout?

I’m fairly proficient at creating complex custom layouts based on ViewGroup. The only thing I’m missing is the ability to create my custom LayoutParams. I really need the ability to get the margins and why not create other extra params to pass in to the parent. How can I go about creating a custom LayoutParam […]

How can I align an element to be in center of and above another element in relative layout?

Here’s a picture so you can understand what I want: I have this green element already set up in my relative layout, and what I want is to put another element (the black one in the pic) above it so it gets centered exactly in the middle of the green element. Keep in mind that […]

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