Questions tagged [android-layoutparams]

The base LayoutParams class just describes how big the view wants to be for both width and height. For each dimension, it can specify one of:

  • FILL_PARENT (renamed MATCH_PARENT in API Level 8 and higher), which means that the view wants to be as big as its parent (minus padding)
  • WRAP_CONTENT, which means that the view wants to be just big enough to enclose its content (plus padding) an exact number

There are subclasses of LayoutParams for different subclasses of ViewGroup. For example, AbsoluteLayout has its own subclass of LayoutParams which adds an X and Y value.

Useful links

123 questions
0
votes
1 answer

How to set FrameLayout height to match one of the child component

I have the following framelayout containing a TextView and ProgressBar. At one given time, only one of them is shown. The hideText flag is initially set to false.
0
votes
0 answers

Not able to set android:paddingLeft using Android Databinding library

I am using Databinding library to update the views from view model object. activity_main.xml
Chait
  • 537
  • 6
  • 15
0
votes
1 answer

How to align the imageview on bottom of another imageview after moving to new location in android?

I have declared two imageViews(imageView1 and ImageView2) in layout. imageView1 assigned to bottom and imageView2 aligned as ALIGN_BOTTOM of imageView1. In code, after performing some action, imageView1 is moving to center of the screen. Now,…
rcr
  • 23
  • 3
0
votes
1 answer

How can I know if I need to call setLayoutParams or just change the values of existing LayoutParams?

How can I know if getLayotParams() return a reference to the effective params or it's just a deep copy of the params? say: MarginLayoutParams layoutParams = (MarginLayoutParams) getView().getLayoutParams(); layoutParams.leftMargin =…
Elad Benda
  • 35,076
  • 87
  • 265
  • 471
0
votes
2 answers

LayoutParams padding applied to parent View but margin to child

I have two nested LinearLayouts - A vertical list of horizontal Lists (im trying to make a Color Palette Picker). val params = LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, …
0
votes
0 answers

Hide Notch grey background when launching splash screen

For react-native app on Android For the devices with Notch - I am able to use full screen mode on all screens except Splash screen by this code : This code basically uses full screen even behind the notch. if (Build.VERSION.SDK_INT >=…
newdeveloper
  • 1,401
  • 3
  • 17
  • 43
0
votes
1 answer

Android switch item position programmatically in a RelativeLayout

I have a RelativeLayout displaying an app name with its icon below. I want to be able from the java side to switch icon and text positions, so the app name is displayed below the icon without having to inflate a new view. How can this be…
Mo Dev
  • 475
  • 6
  • 17
0
votes
1 answer

How do I set layout parameters for Relative Layout?

I'm using Android Studio to create an app. The user will select a button from a list of three buttons which will take them to a new Activity named SurveyActivity. In SurveyActivity, there are a few relative layouts with content. But depending on…
sixcookies
  • 357
  • 1
  • 7
  • 22
0
votes
0 answers

How to access the images below in Constraint layout param in android

I use constraintlayout for container. I have to add images from camera and gallery in to container, so I have to use layout param. When I add imageview and set it to container, I have not access to under imageview. I have to do events move, rotate,…
0
votes
1 answer

mText1.getLayoutParams().height = NEW VALUE does not take effect in popup window

In Android application, I create a LinearLayout which contains a TableLayout which contains some rows and one of the rows contains a TextView called mText1 I set up a pop up window with this LinearLayout with mText1 setting as following…
AndroidHV
  • 369
  • 1
  • 9
0
votes
2 answers

Android support for different screen sizes

I have created this layout. in which showing textview and below it , it has share buttons for insta, fb, copy,tweet. content.xml
0
votes
2 answers

Unknown attribute android:layout_width, layout_height, id, gravity, layout_gravity and other attribute in xml

Getting Unknown attribute error on all android tag. In layout XML, Auto suggestion is not showing all attributes (like layout_width, layout_height, orientation, orientation & all others android attributes.) here Things i have done to resolve this…
0
votes
2 answers

Problem with LayoutParam inside a function

I am trying to clean my java code by placing RelativeLayout.LayoutParams inside a function, so that I don't have to create new layoutparams everytime I add new thing. The problem: I got an error code Unable to start activity…
user9426229
0
votes
1 answer

How to differentiate Layout on the basis of screenHeight?

I have a LinearLayout which I intend to fit within the screen bounds of 5' devices. Currently it is going out of bounds of the screen on 5' devices but stays within the limits of 5.2' inch devices. I intend to use different values for dimensions for…
0
votes
1 answer

How to draw view over the lock screen in oreo?

This my code. I am trying to draw a view on lock screen. It works perfectly fine on android 7.1 but when i run this on oreo, it doesn't work (view cannot appear on lock screen but when you unlock the screen then view comes and service stopped)…
1 2 3
8 9