Questions tagged [android-percent-library]

The Percent package provides APIs to support adding and managing percentage based dimensions in your app.

The Percent Support library adds support for the PercentLayoutHelper.PercentLayoutParams interface and various classes, such as PercentFrameLayout and PercentRelativeLayout.

24 questions
29
votes
1 answer

PercentRelativeLayout, how to set the height programmatically

I am using PercentRelativeLayout from android percent support package. this is what I have in my layout.
g.revolution
  • 11,962
  • 23
  • 81
  • 107
18
votes
4 answers

Replacement for the linearLayout weights mechanism

Background: Google suggests to avoid using nested weighted linearLayouts because of performance. using nested weighted linearLayout is awful to read, write and maintain. there is still no good alternative for putting views that are % of the…
15
votes
1 answer

Missing XML resource type for PercentRelativeLayout Percentage value?

It seems that the new Percent Support Library was released without allowing to reference a Percentage value in a dimension xml file. That is, instead of :
u2gilles
  • 6,888
  • 7
  • 51
  • 75
12
votes
5 answers

Align baseline with a TextView which is wrapped inside a TextInputLayout

I want to align the baseline of TextView "Deficient" with that of EditText "10000". They are both inside I tried the following, but can't get it to…
6
votes
1 answer

PercentFrameLayout: You must supply a layout_width attribute

I try to use a PercentFrameLayout but I get this error message: Binary XML file line #: You must supply a layout_width attribute. This is the xml I use:
6
votes
3 answers

Installation of the com:android:support:percent:22.2.1 library fails in Android Studio

Installation of the com:android:support:percent:22.2.1 library fails in Android Studio, although I have the Android Support Library and the Android Support Repository installed in the SDK Manager. Does anyone know how to fix this? This is my gradle…
mrd
  • 4,561
  • 10
  • 54
  • 92
3
votes
0 answers

Android - Positioning Floating Action Button problems with Percent Layouts and positioning

I'm having an issue with the design support library's floating action button widget and the new percent layouts. The support FAB doesn't appear to support the percent layouts which is causing problems in getting the layout to work properly. I have a…
2
votes
1 answer

Using PercentRelativeLayout specifying only width (heigh auto)

It is possible to use PercentRelativeLayout specifying only the desired width dimension and getting automatic heigh? I mean doing this:
2
votes
1 answer

Switch element not centre aligning horizontally within allocated space

After creating a PercentRelativeLayout, I noticed that the SwitchCompat control does not align to the center horizontally despite settings properties. What can be done in order to resolve this issue? I tried using…
2
votes
2 answers

PercentFrameLayout (square form asked) in RecyclerView not showing

I try to display an ImageView as a square inside a RecyclerView's element whatever is the element's height. Here is what I would like to have: Here is my xml :
Yairopro
  • 9,084
  • 6
  • 44
  • 51
2
votes
1 answer

Assign percentage to PercentFrameLayout with databinding

Trying to create simple graph with layout using percent support library, but I'm not able to figure out, how to assign percents to view through databinding. Tried returning String "60%", float 0.6f, Float 0.6f, int 60. Nothing works.
2
votes
1 answer

Android Animations on Percent Library

I have been researching the topic of animations on Android but have come against a brick wall when it comes to implementing these findings against a project that utilises the Percent library. In particular, I have the following element in my layout…
2
votes
0 answers

PercentRelativeLayout behaves differently on Android M

I'm using PercentRelativeLayout as parent for Grid item layout. It works fine pre Android M ,but on Android M it is overlapped. What could be the reason? Here is the item layout :
2
votes
1 answer

how to set ImageView width using Percent support lib and maintain aspect ratio?

Using the Android Percent Support Library, how can I set the width of an ImageView to a percentage of its containing PercentRelativeLayout, while scaling the height in such a way as to maintain the original aspect ratio?
2
votes
3 answers

Set width of parent linear layout as percentage of the screen

I am building an android application and I have a dialog fragment. The dialog fragment has a set width. However, the issue is that when the app is run on a device with a different screen size, the dialog fragment isn't centered properly. Initially,…
1
2