layoutparams Questions
4
I am creating app in which there is screen with searchBar by this lib.
My activity layout looks like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://sc...
Party asked 8/5, 2017 at 15:3
2
Solved
If I call setPadding() on a view, I can successfully set the padding, however, if I first set the layoutParams and then the padding, or set the padding and then set the layoutParams, the padding is...
Divebomb asked 4/11, 2015 at 13:49
3
Solved
Is it possible to disable screen capture from a fragment?
I know the below works for an Activity class
onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFl...
Prospero asked 14/9, 2015 at 20:28
5
Solved
I've just edited my XML, I've put slide menu code in my XML, but there is an error.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/...
Quisling asked 26/10, 2013 at 9:7
4
Solved
I have a CardView in my XML layout and I need to set margins to it programmatically (This is because I don't need margin at all times. Based on few conditions, I either set or remove the margin).
H...
Synder asked 28/5, 2017 at 3:15
2
Solved
I am making a code that changes its size according to the screen size its application provides. It gets the entire width and height(or its appropriate view's w and h) by onSizeChanged() and onDraw(...
Chromatography asked 11/4, 2011 at 6:22
5
Solved
I need to set the top margin on a RecyclerView programmatically, but I get this exception:
java.lang.RuntimeException: Unable to resume activity java.lang.ClassCastException: android.view.ViewGro...
Lunulate asked 16/8, 2016 at 22:16
2
Solved
I have a View (containing an ad) that I need to scale to fit the screen width at a certain point in time (after the ad is loaded). So I have a method setHeight(myView) that calculates the correct h...
Gunflint asked 16/10, 2014 at 7:5
16
Solved
Background
Many times we need to auto-fit the font of the TextView to the boundaries given to it.
The problem
Sadly, even though there are many threads and posts (and suggested solutions) talkin...
Quinonoid asked 15/4, 2013 at 14:0
5
Solved
In my app there is a LinearLayout which has 0 Layout height. When I click the button this layout height should be LayoutParams.WRAP_CONTENT. This is the code I use in onclicklistner.
LayoutParams...
Stalwart asked 14/3, 2012 at 4:32
3
Solved
I am writing a drag and drop application and got really confused because of some parameters.
Please help to figure out.
First of all, I read the documentation for the View class and got the follo...
Octavia asked 12/5, 2015 at 22:16
3
Solved
pI am working with a linear layout and want to set the maximum height of the view. Under "normal" circumstances, I want the view to use "wrap_content." However, occasionally the circumstances may p...
Kootenay asked 29/6, 2013 at 18:13
5
Solved
I have an EditText, a Button and a TextView. On clicking the button, textview shows the text written in edittext. Is it possible to find the size of textview occupied depending upon text. i.e. If I...
Hong asked 23/6, 2014 at 6:20
3
Solved
I created button in activity programmaticaly, not in xml file. Then I wanted to set it LayoutParams like in this link: How to programmatically set the layout_align_parent_right attribute of a Butto...
Quintillion asked 29/8, 2013 at 21:47
2
I am using CoordinatorLayout as my root View in activity.xml. In that xml , I am using NestedScrollView with appbar_scrolling_view_behavior enabled. But the content inside the NestedScrollView is w...
Verditer asked 1/6, 2017 at 9:27
2
I have written code to set height and width of view dynamically
view.getLayoutParams().width = 120;
view.getLayoutParams().height = 120;
It works perfectly with below nougat devices, but with no...
Thearchy asked 30/12, 2016 at 10:14
5
Solved
I have a linear layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_menu"
android:layout_width="fill_parent"
android:layout_height="70px"
and...
Farland asked 28/5, 2012 at 3:44
2
This piece of code works seems to work in android api 16 - 22 but does not work in api 23. I'm simply trying to display a popupwindow with options in it and dim the background below the popupwindow...
Carrington asked 18/3, 2016 at 20:2
3
Solved
For example, if you want to change LayoutParams of some view to WRAP_CONTENT for both width and height programmatically, it will look something like this:
final ViewGroup.LayoutParams lp = yourVie...
Distrust asked 19/2, 2016 at 7:51
1
Solved
This question may seem trivial and been asked many times, but I couldn't find an answer that will work for me.
I have an ImageView and GLSurfaceView that is drawn on top of ImageView when I push a...
Monoculture asked 11/12, 2014 at 1:0
2
Solved
I am getting error LayoutParams cannot be resolved to a variable on a line of code which is as follows tv.setLayoutParams(new GridView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONT...
Benzyl asked 5/2, 2014 at 14:8
4
Solved
Please read the question before answering with your standard routine to print a Toast :)
I'd like to display a Custom Toast at the top left corner of the screen. I use this code to create the Toa...
Cyndycynera asked 18/11, 2014 at 6:53
2
Solved
I am trying to implement a user resizable edittext view. It can be resized when user drags the edges of the view.
Here is my onTouchListener for edittext. I have only implemented resizing for left...
Cornea asked 11/4, 2015 at 7:46
2
Solved
I have setup my ImageView like the following:
<ImageView android:id="@+id/dl_image"
android:layout_width="60dp"
android:background="@drawable/pictureframe"
android:layout_height="wrap_conte...
Veneration asked 9/12, 2011 at 23:30
4
Solved
this is my first post. I am learning to code in java for android apps.
I am using a LinearLayout "variable named: ll" with a predefined layout_weight (which I want to change whenever I want in the ...
Unni asked 28/4, 2014 at 12:17
1 Next >
© 2022 - 2024 — McMap. All rights reserved.