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

How to change direction of android elevation shadow?

I have FrameLayout with android:elevation="4dp". Shadow of this elevation directed down. I want change direction of shadow to up.
29
votes
1 answer

'Call requires API level 23' error, but getForeground() exists on FrameLayout from API 1

Summary Finally, I found the related issue, setForeground() incorrectly flagged as requiring API 23 on ViewGroups extending FrameLayout. Issue 189041: setForeground() incorrectly flagged as requiring API 23 (NewApi) for ViewGroups extending…
28
votes
1 answer

Programmatically adding fragment to framelayout in android

I am trying to build a UI combining both static and dynamic elements. For this, I have divided my activity into fragments - all app navigation is then done by replacing fragments instead of navigating between activities. In my main activity layout,…
Mike Baxter
  • 6,868
  • 17
  • 67
  • 115
26
votes
4 answers

Trying to add a fragment to my fragment container FrameLayout

I have created an xml file called editor.xml which contains a FrameLayout. In my main activity I am trying to add my custom fragment to my FrameLayout. The error I receive when trying to add my fragment is: The method add(int, Fragment) in the type…
22
votes
4 answers

Warning: This can be replaced with a tag

I have a FrameLayout that contains a TextView and two LinearLayouts: ... a textview and…
Oleksiy
  • 37,477
  • 22
  • 74
  • 122
21
votes
6 answers

How can I align an element to the right in the FrameLayout?

I have a FrameLayout which contains 2 views , the second is something like a Close Button (X) and i want to position it on the right. I've tried layout_gravity = " right ", but that didn't work. This is my layout xml :
Houcine
  • 24,001
  • 13
  • 56
  • 83
20
votes
6 answers

Android: Set margins in a FrameLayout programmatically- not working

here is the code- FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) searchPin.getLayoutParams(); params.setMargins(135, 176, 0, 0); //params.leftMargin = 135; // also not worked //params.topMargin =…
Avisek Chakraborty
  • 8,229
  • 10
  • 48
  • 76
19
votes
2 answers

Convert Any view into image and save it

can any one please help me to know how to capture contents of a FrameLayout into an image and save it to internal or external storage. how can convert any view to image
Akshay
  • 6,029
  • 7
  • 40
  • 59
19
votes
1 answer

RelativeLayout align parent *side* + margin *side*

I've noticed a strange behavior in RelativeLayout when you align a view to the layout's side (any side) and having a large margin in the same direction. I have 2 RelativeLayouts that each contains a simple view. In one layout that view is align to…
18
votes
2 answers

Disable NestedScrollview scroll

Design of my app Screen - 1 (contains Recyclerview-2) Screen - 2
18
votes
3 answers

Is it fine to use LinearLayout instead of FrameLayout?

I am building an application with one Activity MainActivity which consists of two fragments. And I came across with many tutorials that use FrameLayout as the parent container for the fragment layout. However, I came to know that I can still use…
fruqi
  • 4,983
  • 4
  • 26
  • 32
18
votes
8 answers

Android YouTubePlayer with unauthorized overlay on top of player

I'm using YouTubePlayer (YouTube api for android) within a Fragment I am inflating a LinearLayout with the YouTube Player, in this way: fragmentManager = getActivity().getSupportFragmentManager(); fragmentTransaction =…
Sergio76
  • 3,835
  • 16
  • 61
  • 88
17
votes
3 answers

FrameLayout with rounded corners

I have a FrameLayout inside my root view (linear:vertical) that I'm using to hold different fragments depending on user input. The FrameLayout is smaller than the background, so it appears to be "floating". How do I round the corners of the…
Dan Lehto
  • 215
  • 1
  • 3
  • 11
17
votes
3 answers

FrameLayout to RelativeLayout ClassCastException even if there is no FrameLayout used

In my application, I have a layout which has a RelativeLayout to which I want to set margins at runtime programmatically. But when I do that, it gives me ClassCastException saying FrameLayout can not cast to RelativeLayout. I don't have any…
16
votes
3 answers

How to set foreground attribute to other non FrameLayout view

I would like to know how to apply or emulate foreground effect in a view different from FrameLayout, as LinearLayout or RelativeLayout This is what I have now:
cesards
  • 15,882
  • 11
  • 70
  • 65
1
2
3
71 72