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
2 answers

Android Set ImageView in front of Relative Layout

I have a RelativeLayout in my Android App. Now I want to show an ImageView in front of that Layout. The problem is that the ImageView is not in the front, it's a bit transparent and I can see things like EditText and Button. I can't change the…
1
vote
3 answers

RelativeLayout makes no sense

I've been working on this layout for about 7 hours today, and that doesn't even count how much time I've put into it this week. I had posted this earlier today, and since then have progressed immensely. The goal is to get the @+id/contactPicture…
Nxt3
  • 1,970
  • 4
  • 30
  • 52
1
vote
2 answers

Why does LinearLayout not correctly display nested FrameLayout?

I have an XML layout where I nested a FrameLayout within a LinearLayout and attempted to stack a sibling viewing group on top of the FrameLayout. It does not show the sibling viewing group at all, but just the FrameLayout. I wanted to please get…
1
vote
1 answer

LinearLayout within Relative Layout XML

I've got my LinearLayout part of my app complete. I'm now adding a small bar at the top of the screen/activity using RelativeLayout, but I seem to have it backwards of the way I want it in the picture below. The tan-colored Linear Layout is visible…
1
vote
3 answers

Add view programmatically to RelativeLayout android

how can I do to add child view programmatically to RelativeLayout at a given position? For example, to reflect the following picture: my xml: (com.example.TransparentSlidingDrawer child is a simple class that extends with…
user3103823
  • 135
  • 1
  • 3
  • 13
1
vote
1 answer

Android relative layout positioning

I have this code, DisplayMetrics display = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(display); _screenHeight = display.heightPixels; ... int eFieldTopMargin = (int)(_screenHeight*0.25); int…
1
vote
0 answers

LayoutParams crashes app

I have strange problem. Using this code, I get crash when try to make new LayoutParams, before "Error 5". getScreenWidthAndHeight(); Log.d("Error", "1"); eField = (EditText)findViewById(R.id.emailField); Log.d("Error", "2"); …
1
vote
3 answers

ImageView doesn't show underlying View when parts of it made transparent

I've got a RelativeLayout with a View and an ImageView overlaying it. Now, I'm modifying a part of ImageView's bitmap to make it transparent & invalidate the region. That works, but I don't see the first View underneath, just Activity's…
yanchenko
  • 56,576
  • 33
  • 147
  • 165
1
vote
2 answers

How to position a button exactly how I want it?

I'm using RelativeLayout. I understand using Graphical Layout you can't position a button too well. How can I do it in XML? I've tried changing the marginLeft, but nothing moves. All I want to do is position my buttons!
1
vote
1 answer

Keeping relative layout fixed

I would like to know how can I keep my relative layout fixed. I have a relative layout inside that I have an image view. I am also adding custom views to my relative layout. But when I move my custom views the relative layout height increases. I…
ik024
  • 3,566
  • 7
  • 38
  • 61
1
vote
1 answer

Adjust button width according to ImageButton drawable

I've two questions: In the layout xml there is an ImageButton which drawable is a resource. Having drawable-ldpi to xxhdpi in different sizes for this imageButton the width varies depending on which device the app is running. At the bottom in the…
Michael D.
  • 1,795
  • 2
  • 18
  • 25
1
vote
10 answers

ScrollView doesn't work in Android Layout

I designed a simple layout for my test App, a TextView, then a ImageView and a TextView. But the second TextView I want it scrollable (by touch). I have searched and tried many solutions on the net but still can't make it work.
1
vote
3 answers

Android: setting colors for relativelayout inside onTouchListener

I am having some relativeLayout, inside which there are multiple textview and imagebuttons, so in order not to making onTouchListener one by one, I have implemented the below code: relative1.setOnTouchListener(new OnTouchListener() { …
pearmak
  • 4,979
  • 15
  • 64
  • 122
1
vote
4 answers

Android Button does not appear above my TextView

I'm doing a simple Bluetooth App, to control the window of a car (only for research). Layout should be two Buttons (Window up and Window down) and a TextView to printed responses on my actions and parameters. Problem is, that both buttons won't…
Fraggles
  • 463
  • 4
  • 20