Tag: layout

Android background + text + icon for a button

I would like to have an image set to background a text on it and an icon on the left side of the text. Very easy in iPhone, but can’t figure out how to do it at Android, to be resizable that button and keep the icon + text position and distance properly. iPhone: Android […]

Layout Animation Android

I want to Animate two Different layouts. Example I already have the animation the way I want, I just want to animate a different XML Layout. There is a class LayoutAnimationController, but I really dont know how to use it. Can some one point me in the right direction, with an example or good explanation. […]

This RelativeLayout layout or its LinearLayout parent is useless

I’m developing an Android 3.1. and above application. On one activity I generate its layout dynamically. I’m using formdetail.xml as contentview: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.formdetail); Bundle extras = getIntent().getExtras(); if (extras != null) { currentFormId = extras.getString(“FormId”); } } formdetail.xml : <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/detailLayout” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” > […]

LinearLayout does not fill the scrollview

<ScrollView android:layout_width=”fill_parent” android:id=”@+id/scrollView1″ android:layout_height=”fill_parent”> <LinearLayout android:id=”@+id/linearLayout1″ android:layout_width=”fill_parent” android:orientation=”vertical” android:layout_height=”fill_parent”> <ListView android:id=”@+id/listView1″ android:layout_width=”fill_parent” android:layout_height=”fill_parent”></ListView> </LinearLayout> </ScrollView> The scrollview fill the whole screen but the linearLayout1 fill just small part of the screen something near 100dip in height. How can I make the linearLayout1 to fill the parent ?

Android: How do I retrieve Edittext.getText() in custom AlertDialog?

The topic explains what i’m after… I can’t retrieve the EditText from my custom view in android. All I get is a Nullpointer Exception. :/ I’ve marked where the problems are in the code with comments. The ID:s are correct and my XML layout is a simple RelativeLayout containing two EditText attributes. Obviously I’m missing […]

Fade effect between layouts

As by object, I would reproduce fade effect between two layout. Now I’ve this situation: LinearLayout l; LinearLayout l2; To switch between them I’ve used l.setVisibility(View.GONE); l2.setVisibility(View.VISIBLE); I want add fade effect between this transiction, how I can do it?

Set the width of relativelayout 1/3 the width of the screen?

I have a layout like below. Now, I don’t want to set the width of relative layout to fixed 240 dp. I want to set the width of the relative layout to 1/3 the width of the screen. Is it possible to do that in the xml file. If it is impossible, how can I […]

What do I have to add to a layout to hide the titlebar?

I want to hide the titlebar of my app in some of my views. What do I have to add to the layout files I want to hide the titlebar in? Can you provide an example?

Using RelativeLayout dynamically and setting margins in px, dp, inch, mm

My application is just a modified ImageViewer with the options of zooming and dragging. Containing that modified Imageviewer there is a RelativeLayout (that I want to use as an AbsoluteLayout). Then, new elements can be added to the layout to situate them in certain points of the image. The position (x, y) in pixels of […]

Android: NumberPicker doesn´t work

I added a NumberPicker to my layout and debugged my app. Now I see that the NumberPicker doesn´t work, I can´t see any “+” or “-” button and also when I click on a number on my keyboard, nothing happens. Here´s my layout file: <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:paddingBottom=”@dimen/activity_vertical_margin” android:paddingLeft=”@dimen/activity_horizontal_margin” android:paddingRight=”@dimen/activity_horizontal_margin” android:paddingTop=”@dimen/activity_vertical_margin” android:background=”#99cc00″ tools:context=”.Gewichtsentwicklung” […]

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