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

ConstraintLayout vs RelativeLayout performance 2020

I am creating complex layouts with many Views on various screens of my app.The documentation says that: It is a common misconception that using the basic layout structures leads to the most efficient layouts. However, each widget and layout you add…
11
votes
6 answers

Whats up with setScaleX/setScaleY?

While trying to find a solution for the layout that I want, I came across the setScaleX/setScaleY methods, which are members of the View class. View class doc Now looking at the methods of RelativeLayout and filtering by the API Level 8, since I'm…
taymless
  • 779
  • 2
  • 9
  • 24
11
votes
2 answers

CheckBox doesn't appear in CheckedTextView

When I set up my CheckedTextView, it has no CheckBox. Here is the xml code for it:
Cg2916
  • 1,117
  • 6
  • 23
  • 36
11
votes
10 answers

how to half overlap imageview on another imageview in android

how can I overlap images half on one another from layout XML file like this image.
Asad
  • 1,241
  • 3
  • 19
  • 32
11
votes
2 answers

ImageView adjustViewBounds not working with Relative Layout

I have an ImageView and have set its layout_height to "100dp" and its layout_width to "wrap_content". The drawable used has bigger actual dimensions that are 130dp (width) X 215dp (height). When the ImageView is placed inside a LinearLayout, if I…
11
votes
6 answers

How to use the center of a View as a reference point inside a RelativeLayout

I've been using a bit of a hack to stretch a view inside a parent RelativeLayout so that it starts at top-left and ends an bottom-center. While RelativeLayout does let you position something at the center of itself, it doesn't however seem to let…
Juan Cortés
  • 20,634
  • 8
  • 68
  • 91
10
votes
6 answers

android "layout_alignParentBottom" in relative layout

So, I have this layout:
Buda Gavril
  • 21,409
  • 40
  • 127
  • 196
10
votes
2 answers

How do i align a view in RelativeLayout to top-right corner

Im trying to figure out how to align a view in relative layout to its top right corner. Currently it is aligned in top left corner. A simple problem, yet I dont know how to do it. Here is the code: RelativeLayout.LayoutParams…
no9
  • 6,424
  • 25
  • 76
  • 115
10
votes
3 answers

Layout File - Positioning Item to Right of Another Item (Android)

I'm trying to position one item in a RelativeLayout to the right of another. In the example below I want the "," to be placed to the right of the description field. However the problem is it puts the comma on the first line next to the name field.…
GuybrushThreepwood
  • 5,598
  • 9
  • 55
  • 113
10
votes
2 answers

TextView color change on focus/press

I have a some ui widgets including textview inside RelativeLayout which is clickable. My problem is textview text color does not change when relativelayout gets focus although I have set textview color property correctly. Is there any easy way to…
mkso
  • 3,178
  • 4
  • 27
  • 35
10
votes
0 answers

Use of Constraint Layout for developing TV android Apps

I want to know why android developer documentation is recommending to use view groups such as Relative Layout or Linear Layout to arrange views for developing TV Android Apps and not the current standard i.e. Constraint Layout. Is there any specific…
10
votes
2 answers

Android Warning : Grows due to localized text expansion

I am getting this type of warning @id/order_row_date can overlap @id/order_row_amout if @id/order_row_date grows due to localized text expansion. If relative layout has text or button items aligned to left and right sides they can overlap each…
Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
10
votes
3 answers

Bound a View to drag inside RelativeLayout

I have created a draggable view inside RelativeLayout. But it seems to go beyond the RelativeLayout. I simply want to make a View draggable inside ViewGroup And this view is draggable according to Screen. And it is draggable beyond the boundaries…
10
votes
1 answer

Marshmallow RelativeLayout behaves strange with alignBaseline

On Android 6.0 Marshmallow the positioning of an EditText in relation to an ImageView in a RelativeLayout with the attributes baseline and layout_alignBaseline does not work anymore. The behaviour can even be observed in the layout editor in Android…