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
10
votes
1 answer

How can someone create a horizontal scroll list with snapping effect to the center

OK! I've been trying to do this on and of for the last few weeks and cant seem to find a good solution to how I can accomplish what I want. Been trying with HorizontalScrollView, Gallery (which is deprecated). I am now looking into RecycleView…
10
votes
2 answers

How to get distance between views in pixels?

As shown in below image. I do have one relative layout. I have my ImageView in same and I need to get gap in pixels between view starts and this ImageView. My activity is as below. Please advice. I tried various ways like topY() but couldn't find…
Ketan Bhavsar
  • 5,338
  • 9
  • 38
  • 69
10
votes
2 answers

How to show/hide grouped views in Android?

I want to create an activity such as mentioned in photo... as soon as I press the maximize button I want it to become full screen for the activity and part 1 become minimize, and again when I press the restore button I want it to become in a first…
10
votes
3 answers

Using Navigation Drawer without TitleBar or ActionBar

I'm adding a Navigation Drawer to this app that I am developing and I have scoured the internet; forums, stackoverflow, android developer documentation, and still have not found a great answer for this. I know that it is possible to do this without…
10
votes
1 answer

How to center a LinearLayout in RelativeLayout?

I would like to center a LinearLayout in a RelativeLayout but i have a problem, the margin-bottom stays attached to bottom. Here is the view : http://nsa33.casimages.com/img/2013/03/12//130312103139937791.png And here is the code of the layout…
9
votes
2 answers

two or more nested RelativeLayout

I want to ask, working with two or more nested RelativeLayout. First code looks like picture 1, When I add android:layout_alignParentRight="true" in second RelativeLayout, this looks like picture 2. I want to align text right to second…
atasoyh
  • 3,045
  • 6
  • 31
  • 57
9
votes
1 answer

Layout background messing on margin

I'm trying to make a trimmerbar to my video player trimmer_bar.xml
Rafael Lima
  • 3,079
  • 3
  • 41
  • 105
9
votes
1 answer

How to display a TextView below an other one in Android with XML files?

I am pretty sure that a parameter will do the trick but I can't find the one I am looking for. I am trying to display one TextView -file_type- below the file_title TextView. What would be the parameter that I should add to the file_type TevxtView…
Spredzy
  • 4,982
  • 13
  • 53
  • 69
9
votes
1 answer

How to construct a keyboard hints layout in android

Right now I have created a keyboard layout using linear layout, each key is an image e.g. "Q" , "W" , "E" are different images. The problem is , how to add the hints image live the above? the idea is , the hints image is hidden by default and when…
9
votes
2 answers

Android Custom View shows solid black after calling invalidate

In this code, I would like to draw a line between the top of two ImageViews. However, when running the app, the custom view is shown solid black after calling invalidate(). Here is my code: public class ArrowView extends RelativeLayout { public…
9
votes
1 answer

"FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS" affects getRootView().getHeight()

I found a issue that affects Relative Layout height while I was trying to add color to status bar. adding Flag affected of calculation of the relative layouts rootView's height. private void changeStatusBarColor(){ if (Build.VERSION.SDK_INT…
9
votes
4 answers

What layout folders are required to support all Android Devices?

I am developing a Calculator App which have a Relative Layout for Portrait Mode. All Buttons and TextViews are placed in this single Relative Layout and a same Relative Layout for Land mode. I have been digging web for almost 15 days but found…
Kamil Mahmood
  • 527
  • 9
  • 22
9
votes
2 answers

Elements overlapping on top of each other in relativeLayout

I have created an Activity and used RelativeLayout which comes in by default in Android Studio. I am trying to place a button just before my TextView but I am unable to do that. Here is the result: Here is my code:
Sachin Jain
  • 21,353
  • 33
  • 103
  • 168
9
votes
3 answers

How to inflate RelativeLayout from XML

I got a very specific task to inflate view. To be honest i dont really understand what I should do exactly. The only method, which compiled probperly was that @Override public View getView(int position, View convertView, ViewGroup parent) { …
Mabjik
  • 255
  • 3
  • 5
  • 10
9
votes
4 answers

how to move view to the center of screen using animations in android

i'd like to move a view (in my case - a button, but it doesn't really matter) to the center of the screen. when i'm running the move without animations, it works. however, i'm having a hard time deciding which animations i should use to do so,…
dusm
  • 1,207
  • 4
  • 18
  • 24