Tag: layout

Incorrect items sizing in layer-list on pre-lollipop

I have a layer-list <?xml version=”1.0″ encoding=”utf-8″?> <layer-list xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:right=”2dp” android:left=”2dp” android:bottom=”2dp” android:top=”2dp”> <bitmap android:gravity=”center” android:src=”@drawable/ic_menu_alert”/> </item> <item android:height=”10dp” android:width=”10dp” android:gravity=”right|top”> <shape android:shape=”oval”> <size android:height=”10dp” android:width=”10dp”/> <solid android:color=”@color/navigation_drawer_notification_red_color”/> </shape> </item> </layer-list> which shows this image On lollipop and above everything is fine but on pre-lollipop red circle lose all sizing and padding attributes and […]

Small Popup for Instructions, like foursquare ones

After seeing the last screenshots of new foursquare application and their balloon like cartoon instructions, I’d like to create some of these in my application. I found a similar question for iPhone Small popup for instructions… How? Here is another screenshot of foursquare app: I’d like to know how I could achieve that with Android. […]

Drag to dynamically resize a pair of adjacent layouts on Android

I have a pair of adjacent views in an Android application. I’d like to give the user the ability to drag a widget to change the relative size of the two views within a larger container. If SlidingDrawer let the user pin the drawer wherever they wanted, that’d likely get me what I want. My […]

Android view object reuse — prevent old size from showing up when View reappears

EDIT: One more piece of possibly relevant info: The use case in which I see the problem is tab switching. That is, I create view X on tab A, remove it when leaving tab A, then recycle it into tab B. That’s when the problem happens. This is also exactly when I need the performance […]

How to set the max height of a Layout in android?

I have to implement layout like this; The layout should wrap the content if the content within it is less. If the content goes beyond some size, like 300dp, it should be set to max heght(300dp) and that be able to scroll. Is there any properties to do like this, if not any workaround?

Why do child views inherit the alpha value from parent layout

In my app I’ve set a background image of the top level linearlayout and then to fade the background I set its alpha to .2 but this creates an odd problem in that it also sets the alpha for all children of the layout as well, even if I explicitly define a different alpha value […]

Android: How can I make text views float to the left?

I want to make textviews float to the left (like css floats). The reason I have so many textviews is I want every word in my app to be clickable. So I want this result: Currently, I have the following xml codes: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:orientation=”horizontal” android:baselineAligned=”false”> <TextView android:text=”@string/nicholasStr” android:layout_width=”wrap_content” android:textSize=”18sp” […]

How to dynamically set layout parameters in Android?

I have these text fields which I generated dynamically. But I can’t seem to set layout parameters for them. Please tell me what I’m doing wrong. I’m able to generate the fields without layout parameters. However, If I use LayoutParams, it doesn’t even get generated. Code: TableLayout table = (TableLayout) findViewById(R.id.TableLayout1); TableRow tr = new […]

Android: Using alignBaseline for an image following text

Below is a TextView followed by an ImageView contained in RelativeLayout. I’m trying to get the bottom of the image to align with the baseline of the text. When I use alignBaseline for the image,reference the TextView, it is the top of the image that aligns with the baseline of the text instead of the […]

Honeycomb (3.1) adjustResize no longer working?

My activity has android:windowSoftInputMode=”adjustResize” and behaves accordingly in Android 2.1: Before soft keyboard appears With keyboard However, in Honeycomb the soft keyboard does not resize my layout, it instead covers the buttons: Same behavior on both the 10 inch Galaxy tab and the Motorola Xoom. I’ve reworked my layout several times trying to get it […]

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