android-layout

Android 1.5-specific error

Hello, I am having trouble with with getting my application to function on android 1.5. It works fine in 1.6, 2.1, and 2.2 but whenever I attempt to run it in 1.5, I get an immediate force close with the LogCat output: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.qrohlf.activites/com.qrohlf.activites.Book...

Absolute Centering in Android Layout

Hi guys, I've spent so much time trying to figure this out. I'm building a dialog layout and trying to get the Title centered relative to the dialog while having 2 buttons on either side of the title. The buttons are to be 'gravity-ed' towards far left and far right. The easy part is centering the dialog, OR doing the buttons far lef...

Android layout replacing a view with another view on run time

I have a xml-layout file main with two textviews A/B and a view C. Than I have two other xml layout files option1 and option2. Is it possible to load either option1 or option2 in run time via Java into C? If so, what function do I have to use? ...

Writing custom LinearLayout for android.

I have a custom layout that draws a transparent rounded rectangle beneath its children. The problem is when I try to add it to my xml file, it doesn't show up. Also, when I try to add parameters to it (i.e. android:layout_width) the popup shows that none of them are available. The same thing happens to any child views I add. Can anyone h...

Trouble refering to a custom View in a layout XML

I am trying to refer to a custom View in the helloWorld XML layout but I get the following exception: Error inflating class acme.my.MyTextView. However, I am able to instantiate the view and add it to the main content view manually. The custom View is built from it's own XML layout. How do I get this to work? public class MyTextView...

Using default font styles in Android

How do you use the Android default font sizes in xml? I tried: android:textAppearance="@android:style/TextAppearance_Large" But I get: error: Error: No resource found that matches the given name (at 'textAppearance' with value '@android:style/TextAppearance_Large'). ...

Android 4x2 widget

Hi all, Looking at the Facebook widget I realized its a 4x2 cell and this isn't one of the standard sizes. I have tried to re-create a widget of this size (either as 320x200 or 294x146 px) however the widget doesn't look good on all devices. The widget layout is : <?xml version="1.0" encoding="utf-8"?> <!-- Portrait --> <RelativeLayo...

How do I design a custom Android control and use it in Xml?

I understand how to create a custom Android control, and I believe I understand how to pull attributes for it from the Xml layout. I don't know, however, how to get any children elements from it. Here's a visual example of what I'm trying to accomplish: public class Menu extends LinearLayout { // Custom Code } public class MenuIte...

Rotate View Hierarchy 90 degrees

Hello, I am working on a subclass of FrameLayout that is supposed to rotate all of its children by 90 degrees. I am doing this to overcome the landscape-only camera limitation present in android 2.1 and below, by having the activity be in landscape, but placing my camera overlay into this framelayout overlay to cause it to appear as if ...

Android: Background with specific size?

Hi all, I'm having some trouble trying to create a program for Android 2.1-update1 with a background of a specific size. It seems that the only option is to scale the image according to the device screen size/orientation. Is there a way to create an empty LinearLayout (edit: with a specific size) behind the gui widgets and then set the...

Android - Needed help in Layout Tricks

As i have referred this site for Layout Tricks. overthere one attribute is declared as android:layout_weight="1". so my confusion is regarding android:layout_weight. where is the exact use of android:layout_weight ? Where should we use android:layout_weight ? pls anybody focus their knowledge. Thanx ...

Android - Layout gravity/width related problem

Hello all, I know i am doing a small mistake. I am using LinearLayout and i want to place the "icon-image" at "Center". I am using the following code: <LinearLayout android:id="@+id/LinearLayout01" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" ...

Android - gravity and layout_gravity

Hello all, I know we can set the following value to the anroid:gravity and android:layout_gravity : center center_vertical center_horizontal , etc. But i am confused regarding these both. what is the difference between the usage of android:gravity and android:layout_gravity? ...

Android LinearLayout with color resource: What am I doing wrong?

I followed this tutorial to create a color state list for a particular Android view. I just want it to highlight when clicked so the user knows why the screen just changed. When the view is rendered, I get the following error: org.xmlpull.v1.XmlPullParserException: Binary XML file line #3: tag requires a 'drawable' attribute or child...

Making EditText and Button same height in Android

Hi, i have an EditText and a Button in my LinearLayout and i want to align them closely together so they see seem to belong together (edittext + micButton for speech input). Now they don't have the same height and they aren't really aligned well (button seems to be a little lower than the EditText). I know I can apply a negative margin...

Unable to Add a subview to a LinearLayout with "Wrap_Content"

I'm using data to build elements of a ViewGroup. The ViewGroup are LinearLayouts, except the leaves, which are TextViews. Because Data draws the hierarchy, I inflate the LinearLayouts and TextViews from individual XML files programatically on the fly. My Problem: When I create a LinearLayout with the attribute wrap_content, then infla...

usage of setcontentview in android

Please help me for going from main.xml to another layout by showing the main layout for 5 seconds with an image. Only one image is there in main layout. ...

ListView and images

I have two problems with ListView+images. I get the values for the list from an xml file which contains all necessary infos. I need to set up a Listview. Every row should contain an icon and a title. The icon is a local drawable (shipped whith the app). An example what I want to achieve can be found here: http://www.tutomobile.fr/wp-...

Why is the generated Android class called R?

I'm just curious, who in the world names a class R ? Is there any history behind this convention? Thanks, Teja. ...

Android - Orientation Change - exits app but w/o crashing

Looked at other posts but, haven't seen the answer I'm looking for... I have two layouts: layout-port and layout-land. If I run the app with emulator or device, either vertically or horizontally, the app runs fine with the correct layouts. However, if I rotate either the emulator or device, the app exits. There's no crashing, perse',...