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

textIsSelectable is not working with descendantFocusability=blocksDescendants

I had an issue that my ScrollView in fragment auto-scroll to bottom. So to fix this issue I have added following line in RelativeLayout as suggested in this answer: android:descendantFocusability="blocksDescendants" But after adding this line,…
Faisal Shaikh
  • 3,900
  • 5
  • 40
  • 77
8
votes
3 answers

Setting up RelativeLayout in java code

I'm having a hard time getting two text views to appear on top of each other in my java code. Here's the code I'm experimenting with: /** Called when the activity is first created. */ @Override public void onCreate(Bundle…
Andi Jay
  • 5,882
  • 13
  • 51
  • 61
8
votes
1 answer

How to bring progress bar in top of layout

I have included a progress bar in my relative layout, but it is running behind the layout. Is there any way I can bring it in front show that it show when the page is loading.
Shamim Ahmad
  • 808
  • 3
  • 22
  • 40
8
votes
3 answers

Why title is not centered in toolbar?

I am trying to add customized toolbar i want cart badge count so i added the relative layout to toolbar widget, when i didn't added relative layout in toolbar the title appeared in center but now removing relative layout causes problem in adding…
8
votes
1 answer

Hiding the action bar causes bottom aligned item in RelativeLayout to jump

i have RelativeLayout with a view that is aligned to the parent bottom. when i call actionBar.hide() the view slides up as the action bar slides up, then once the action bar has fully disappeared, the view jumps back to the bottom. how do i prevent…
8
votes
4 answers

android gridlayout not showing in emulator API 22

I have an app that functions exactly as desired on an actual device Nexus 6P running API 23 and an emulated 6P, 5 & 4 running API 24, but is showing odd behaviour wrt GridLayout on emulated Nexus 5 & 4 running API 22. The app only has a single…
8
votes
4 answers

Android make button 1/3 of screen width and height in relative layout

I have some XML. In this XML there is a single button inside a relative layout. The relative layout takes up the entire screen. I want the button to have 1/3 of the screen width and height. How could I do this? Here is the XML:
Foobar
  • 7,458
  • 16
  • 81
  • 161
8
votes
2 answers

Android Scrollview in RelativeLayout with ButtonBar

I'm trying to implement a login view where several EditTexts and a logo are displayed on the screen with a ButtonBar at the bottom, something like this: alt text http://russellhaering.com/media/addAccount.png The problem is that on very small…
russell_h
  • 956
  • 2
  • 9
  • 18
8
votes
3 answers

How to fill space between two views within a RelativeLayout

I have two views. The top view is set to ... android:layout_alignParentTop="true" And the bottom is set to ... android:layout_alignParentBottom="true" How can I fill the remaining space with a third view? According to this answer here, I should…
the_prole
  • 8,275
  • 16
  • 78
  • 163
8
votes
3 answers

How to align 8 little circles around of a centered big circle, like attached image shows?

I have to do this layout: I was trying to align the views, using RelativeLayout and layout_toRightOf, layout_below, etc, but the best that I achieved was this: Here are the xml:
Daniel Nazareth
  • 530
  • 1
  • 6
  • 22
8
votes
2 answers

Android: Slow performance using a big image in ImageView

I have an Activity where I have a background image in an ImageView, and nine transparent buttons on top of the image. https://i.stack.imgur.com/GGQqd.png When I tap any of the buttons I make a RelativeLayout appears in the top of the…
8
votes
2 answers

Having a EditText over a soft keyboard with a GL View in the background programmatically

I am working on a game and I want an EditText position above the soft keyboard when it pops up. Here is what my code looks like when I build the View Hierarchy in my Main…
8
votes
3 answers

Android LinearLayout background Image

I'm having a problem with my view if I try to display an image as background, it took the whole space and the second child of linear layout (2 RelativeLayout that appears next to each other) does not appear into view. How can I set image as…
user3141985
  • 1,395
  • 4
  • 17
  • 36
8
votes
3 answers

How to put Imageview Behind other layout

I am using a imageview for animation so that it will look like movement left to right. but my image is displaying front of other views so that user is able to click on image. i am trying to display it behind the other view.
Rahul Rawat
  • 999
  • 2
  • 17
  • 40
8
votes
3 answers

Android AdMob: addView doesn't show ad until return to activity

I'm trying to add a banner ad to the top of my game. My activity uses a RelativeLayout with a custom SurfaceView. I want the ad to overlap the SurfaceView. The ad loads and is clickable, but is not drawn to the screen. When I leave the activity and…
TomEverin
  • 415
  • 1
  • 5
  • 12