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

Make dialog take as much place as possible with maximum dimensions

I have an AlertDialog with a ConstraintLayout as a view and all of the children have a height of 0dp, i.e match constraints:
0
votes
1 answer

How to get a ConstraintSet working inside a programatically generated ConstraintLayout descendant?

I have a view that inherits from ConstraintLayout. Inside this layout I place the children by use of a ConstraintSet. This works as long as use a given AttributeSet form outside in the constructor: public AnswerView(Context context, AttributeSet…
Blcknx
  • 1,921
  • 1
  • 12
  • 38
0
votes
1 answer

RelativeLayout. Overlap Image and Text in Java Code

I want to make a message which contains a image and text. The text should be on the center of the image. I found some informations and I used RelativeLayout. And I succeed overlap image and text. But the text is not on the center of image. How can I…
0
votes
1 answer

How to increase layout_marginBottom by a number of pixels?

In a game I display a custom View and a FAB in a FrameLayout:
0
votes
2 answers

How set android:layout_marginBottom programm?

To drag the Image on the screen I created my own class: private class CustomImageView extends AppCompatImageView In the constructor I want to set params: public CustomImageView(Context context) { super(context); params = new…
0
votes
2 answers

How to increase height of particular view postion using layout params

private void generateView() { for (int i = 0; i < 10; i++) { mview = new LinearLayout(getActivity()); mview.setBackgroundResource(R.color.grayColor); LinearLayout.LayoutParams layoutParams = new…
0
votes
1 answer

How do I get an editText to appear below my image, each time I take a picture?

I'm making a notepad type of app in which the user can take and place pictures in between the text as he is typing it. In my app I have a button , editText and imageView. When it starts, there is only the button and an editText. The user types into…
Nirvan
  • 81
  • 1
  • 10
0
votes
1 answer

Android widget : set width/height or x/y programmability

How to access UI element style from widget and how to setup position or dimension ? I know for setText : RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.widgetlayout); remoteViews.setTextViewText(R.id.updateText, "New…
Nikola Lukic
  • 4,001
  • 6
  • 44
  • 75
0
votes
1 answer

Android WindowManager changing screen orientation

Im adding a camera overlay with WindowManager to a running Activity. When I start the camera and call for the WindowManager, it changes my screen from portrait to landscape, even though I assigned the appropriate portrait tag to the…
0
votes
1 answer

Android: swap width and height on orientation change

I want to rearrange my views in onConfigurationChange when screen orientation changes. Activity restart and views recreation are too consuming; so I have to keep views. There is one LinearLayout I want to change orientation of. If orientation is…
George Sovetov
  • 4,942
  • 5
  • 36
  • 57
0
votes
3 answers

Android Layout match_width

Is there anyway in Android to set the height of the LinearLayout to match it's width?
user5568766
0
votes
0 answers

How do I drop an Android ImageView object in a particular area on the screen?

I'm just coming back to Android after a number of years doing C# on Windows and wanted to port my universal app to Android. It's a version of Solitaire based on cribbage. Essentially, what I've done is defined a relative layout containing a number…
newps
  • 1
  • 2
0
votes
2 answers

android layoutparam support multi screen

I have a view, I want to place it at (x, y) position via WindowManager.LayoutParams. My code is: mHeadLayoutParams = new WindowManager.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, …
Ngoc Trung
  • 35
  • 7
0
votes
1 answer

Valid layout params for RadioButtons

What layout parameter could I use to make my RadioButtonslayout_alignParentStart and Below a View? In Android studio, doing this creates an error. Or is there an attribute of some sort I could add to the RadioGroup? here is the code:
0
votes
0 answers

Resize EditText according to Font Size

I am creating dynamic edit texts using below code: final EditText rowTextView = new EditText(DragActivity.this); rowTextView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); rowTextView.setHint("Type…
1 2 3
8 9