Questions tagged [android-framelayout]

Android layout that uses the screen to display views that can be stacked on top of each other, with the most recent child added on top.

1070 questions
191
votes
5 answers

What are the differences between LinearLayout, RelativeLayout, and AbsoluteLayout?

I am confused about the difference between LinearLayout, RelativeLayout, and AbsoluteLayout. Could someone please tell me the exact differences between them?
164
votes
13 answers

Full screen background image in an activity

I see many applications that use a full-screen image as background. This is an example: I want to use this in a project, the best way I've found so far to do this is to use an image with a large size, put it in a ImageView and use android:…
Sergio76
  • 3,835
  • 16
  • 61
  • 88
124
votes
5 answers

What does FrameLayout do?

I'm new to programming. I was using Graphical Layout then when I was reading xml file, I saw FrameLayout. Then I searched, but I couldn't find something useful. What is FrameLayout and what does it do?
Amin Ghasemi
  • 1,361
  • 2
  • 8
  • 7
95
votes
6 answers

Android center view in FrameLayout doesn't work

I have a FrameLayout in which I have 2 controls: - a custom view which draws a image and some text on it - a textview with a text I want to center both in the FrameLayout but I can't manage to do it. The Texview is centered just fine, my cusom view…
Alin
  • 14,809
  • 40
  • 129
  • 218
87
votes
10 answers

How to disable behind view click event Framelayout

Here i have one view pager activity which has one imageview and 2 overlay bars. there overlay bars i made using android xml file layout itself. Here my requirement is like that 1) single tap on view pager's imageview first time = show top and…
71
votes
6 answers

getHeight returns 0 for all Android UI objects

I'm building a UI, and it's all static defined in the XML. All of it has weights all over the place, and while it looks right, I wanted to see that things actually have the right height and all. The problem is that no matter where I call…
Alex B
  • 1,575
  • 5
  • 16
  • 19
60
votes
1 answer

FrameLayout vs RelativeLayout for overlays

I need to implement an overlay (translucent) screen for my app, something similar to Showcase View My guess was to use FrameLayout for this usecase, because it is used to stack items on top of each other. But I was surprised to see that the above…
dev
  • 11,071
  • 22
  • 74
  • 122
53
votes
8 answers

Button always displays on top in FrameLayout

I have FrameLayout like this:
50
votes
6 answers

Android Fragment does not respect match_parent as height

Sorry for the huge code dump, but I'm truly lost. MyActivity.java onCreate: super.onCreate(savedInstanceState); setContentView(R.layout.activity_singlepane_empty); mFragment = new PlacesFragment(); getSupportFragmentManager().beginTransaction() …
45
votes
2 answers

Android: when / why should I use FrameLayout instead of Fragment?

I am building a layout for large screens, that is supposed to consist of 2 different parts, a left one and a right one. For doing that I thought using 2 Fragments is the right choice. Then I had a look on the example of the navigation with the…
Terry
  • 14,529
  • 13
  • 63
  • 88
45
votes
3 answers

Why is a FrameLayout used for fragments?

Wherever I look, FrameLayout seems to be used as the FragmentContainer. Why is FrameLayout always seen with Fragments?
maysi
  • 5,457
  • 12
  • 34
  • 62
43
votes
9 answers

Scale background image to wrap content of layout

I have a layout that contains some text fields and has a background image that's displayed at the top of my activity. I'd like the background image to scale to wrap the content (don't care about aspect ratio). However, the image is larger than…
40
votes
1 answer

Get Fragment dynamically attached to ?

Well, i got a simple : Then in my code, i…
midnite
  • 5,157
  • 7
  • 38
  • 52
39
votes
1 answer

android:elevation only have shadow effects on the bottom side, how to make the shadow effects show on top side?

I use a framelayout at the bottom of an activity, in order to show the shadow effects on the fragment, I add android:elevation. But the shadow effects only appear in the bottom side not on top side, any one could give me some advice?
39
votes
8 answers

ClassCastException android.widget.FrameLayout$LayoutParams to android.support.v4.widget.DrawerLayout$LayoutParams

I'm working on the Navigation Drawer for Android. As per my requirement I was to display gridview and listview of items in the navigation drawer. I have created a linearLayout in the layout xml file and placed the two widgets(Grid view, and…
1
2 3
71 72