Questions tagged [android-relativelayout]

Android layout that displays child views in relative positions to each other or to the parent view.

RelativeLayout is a view group that displays child views in relative positions. The position of each view can be specified as relative to sibling elements (such as to the left-of or below another view) or in positions relative to the parent RelativeLayout area (such as aligned to the bottom, left or center).

RelativeLayout is a powerful utility for designing a user interface because it can eliminate nested view groups and keep your layout hierarchy flat, which improves performance. If you find yourself using several nested LinearLayout groups, you may be able to replace them with a single RelativeLayout.

This tag is to be used with more general or tags.

Useful links

3853 questions
1
vote
1 answer

Android Layout alignment messed up in Landscape

This is my first coding in Android. I have a device with 5" screen and 854*480 resolution . The following code looks perfect on portrait but everything moved left on landscape mode(it looks really bad). I have used dp units as it is recommended but…
1
vote
4 answers

objects below scroll view is not showing

I have linear layout which contains scroll view and relative layout, scroll view is showing but relative layout object below scroll view got disappeared. I have posted my code. I don't know where I have done mistake......
1
vote
2 answers

UI design for Multiple Screen sizes

I had developed an android app with RealtiveLayout but when I run on small screen devices the fields are overlapping. How can I get the width and height of the device programatically so that it is easier for to adjust the screen size
Sukan
  • 346
  • 1
  • 3
  • 19
1
vote
2 answers

Add a button next to another one, programmatically

I'm developing for Android API v11. There is a large RelativeLayout area (like a canvas) that should be filled with a number of buttons, programmatically. Each button represents a video, and I've extended the android.widget.Button class with my…
slhck
  • 36,575
  • 28
  • 148
  • 201
1
vote
6 answers

Create Android Layout

I'm pretty new to Android development and would love some help creating a simple layout on android. This layout will be used in a listview. This is the look I'm going for: This is what I get (don't laugh): The bottom row of text is overlapping the…
vkapadia
  • 290
  • 1
  • 6
  • 17
1
vote
3 answers

Vertically centering two TextViews in a RelativeLayout

What's Happening I am writing a PopupWindow containing two TextViews, where the second TextView should be centered vertically in the popup, and the first TextView should be directly above it. The problem is that the RelativeLayout seems to be…
tar
  • 1,538
  • 1
  • 20
  • 33
1
vote
2 answers

Android center horizontal not working

I got this code, a linearlayout inside relativelayout... however its not centering horizontally... any idea why? i want the linearlayout to be horizontall centered. i am filling it with images via code.
user3278732
  • 1,694
  • 10
  • 31
  • 67
1
vote
1 answer

How to Radiogroup for a radio button in a Relative android layout

I'm Developing an android app in which the login activity contains radio button for the field department and years of experience. And I've designed my login activity in Relative layout.So now i wanted to RadioGroup the radiobuttons without changing…
Steve
  • 117
  • 2
  • 3
  • 11
1
vote
1 answer

Android layout is missing elements when debugging on phone

I am experiencing some strange behaviour with my layouts. As you can see from the screenshot below (of the layout in eclipse) the 'register' button appears just fine at the bottom of the screen. Before However, if you now take a look at the…
1
vote
4 answers

Top LinearLayout to take maximum space before bottom LinearLayout

First of all, here is the structure of my activity_main.xml file : RelativeLayout LinearLayout fragment (Google Map) LinearLayout SeekBar TextView ImageButton I am trying to stick the second linear layout (the one not containing the map) to…
halpsb
  • 1,106
  • 2
  • 18
  • 28
1
vote
2 answers

How to make a button's location movable based on the number of items in the ListView

In a layout file I have a Listview whose size can grow/shrink dynamically. I have a button btn_rec_add and it's click event I add an item in the ListView. I have tried many changes in the Layout file but haven't been able to make the button shift…
1
vote
3 answers

How to restructure the layout to make it better?

In my app, I have a form where a user enters his/her name and address details. I have created the layout file as shown in the Image. It looks pretty ok but I want it to look better and moreover when the values in the fields city, state, postcode and…
1
vote
1 answer

Relative layout similar to WhatsApp messages

I am trying to develop a Chat Application in Android. I need to create a layout similar to WhatsApp. Two TextViews - One for message and another one for time. They both should be wrapped to the width and height. I am using a RelativeLayout to align…
avinash
  • 33
  • 5
1
vote
1 answer

Android layout structuring within listview

I have a listView in which in each row I have a structure as following : When I am trying by margin my image is getting back to relative layout.What is the way of achieving this type structure.Should I use any other layout ? what is the efficient…
Anshul
  • 9,312
  • 11
  • 57
  • 74
1
vote
2 answers

Android viewpager under RelativeLayout

I am working on ViewPager. I wrote code which can create ViewPager and also I have some java class, but I want my ViewPager must be below the layout. This is a my xml code