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

missing border line when using android relative layout

I have this android layout xml:
Elad Benda2
  • 13,852
  • 29
  • 82
  • 157
1
vote
1 answer

centering textView in RelativeLayout

Does someone know why the following code doesn't center the text in the button but the second one does ?
1
vote
3 answers

Center RelativeLayout within Scrollview

I am trying to set the position of my RelativeLayout in the center of the screen. The RelativeLayout is inside of a ScrollView, with the following code. The catch is that in my emulator (Android 4.2) it works great, but if I execute it on a 2.3…
Chayemor
  • 3,577
  • 4
  • 31
  • 54
1
vote
1 answer

RelativeLayout onClick onTouch not working

I am having trouble attaching onTouch/onClick events for a RelativeLayout. I have searched a lot on internet, and could find the possible solution as using dispatchTouchEvent(MotionEvent). But I don't want to use this way, as I am having some…
1
vote
2 answers

I am creating an Android App. I am trying to create the main menu GUI incorporating Image Buttons but my app keeps crashing

This is the first app I have ever tried to create, I am doing so for a college project. The main menu worked fine with the RelativeLayout when I was just using text buttons, but since I've switched to image buttons the app keeps crashing. I don't…
Ashley Keating
  • 119
  • 1
  • 5
  • 12
1
vote
0 answers

android: Image disappears while translation animation

I'm trying to rotate the image as shown in the following bead images clockwise. But the problem is pretty much evident from the pictures i.e. the bead is getting disappeared. -> -> -> -> Following is my xml:
Pankaj Singhal
  • 15,283
  • 9
  • 47
  • 86
1
vote
1 answer

Child view of a cutom RelativeLayout doesn't come to front

I have a custom Relative Layout(a class extended to RelativeLayout). I draw some bitmaps on a canvas using the method dispatchDraw(). And I want to show an Edit text box on top this canvas. So I create a new instance of EditText and bring it to…
Wimansha
  • 61
  • 1
  • 7
1
vote
2 answers

Android: onTouchListener in root view (RelativeLayout) isn't working

I'm developing an Android application and I'm trying to capture OnTouch events in my whole screen. All my activities will have a header with two buttons and then a body that's going to change. In the Activity I'm testing right now the body is a…
PX Developer
  • 8,065
  • 7
  • 42
  • 66
1
vote
2 answers

Get dimensions of RelativeLayout at run-time

I am trying to get the dimensions of the width and height in pixels of the RelativeLayout that I highlighted in red in the below picture. In my code below, for testing purposes, I am setting the text of the Button in the RelativeLayout to the width…
Matt
  • 3,882
  • 14
  • 46
  • 89
1
vote
1 answer

RelativeLayout LayoutParam Above

I have two views, lets say A and B. I want A to be placed above B vertically, but center-aligned with B horizontaly, i.e. I want to achieve this: I tried: RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) …
1
vote
1 answer

How to set position:fixed in android?

In my app, there is a login and password field near the middle of the screen. I have this in the manifest android:windowSoftInputMode="adjustResize|stateHidden" So that the fields are still visible when the keyboard is showing. But the problem is,…
omega
  • 40,311
  • 81
  • 251
  • 474
1
vote
3 answers

Android RelativeLayout Transparent

I can't get my relativelayout to be able to be set to transparent. I have tried many different methods, custom view from class, adding android:background="@android:color/transparent" etc. They either show a white like in the picture below, or they…
1
vote
1 answer

android ViewPager RelativeLayout 's button is invisible

**The RelativeLayout is one of viewpager's view. No item or some items the button is visible but,when the Listview's item fills the screen.the button is invisible.**
1
vote
1 answer

Android - Relative layout align items in horizontal so that they always have same space in between them

I have 2 rows per 4 images on my Relative Layout as shown in this image: I almost have it as it's required however when the app is run the bottom and top both left and right images stick to the edge of frame however the ones in the middle have a…
Sterling Duchess
  • 1,970
  • 16
  • 51
  • 91
1
vote
3 answers

Center ImageView

Been switching from linear layout and relative layout, because I wanted to attain the centering of the image.
rahstame
  • 2,148
  • 4
  • 23
  • 53
1 2 3
99
100