Questions tagged [android-percentrelativelayout]

Subclass of RelativeLayout that supports percentage based dimensions and margins. You can specify dimension or a margin of child by using attributes with "Percent" suffix. The tag is to be used with the [android] tag.

Subclass of RelativeLayout () that supports percentage based dimensions and margins. You can specify dimension or a margin of child by using attributes with "Percent" suffix.

Usage:

Please, use the tag jointly with tag.

Example:

<android.support.percent.PercentRelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
    <ImageView
        app:layout_widthPercent="50%"
        app:layout_heightPercent="50%"
        app:layout_marginTopPercent="25%"
        app:layout_marginLeftPercent="25%"/>
</android.support.percent.PercentFrameLayout/>

It is not necessary to specify layout_width/height if you specify layout_widthPercent. However, if you want the view to be able to take up more space than what percentage value permits, you can add layout_width/height="wrap_content". In that case, if the percentage size is too small for the View's content, it will be resized using wrap_content rule.

From PercentRelativeLayout:

This class was deprecated in API level 26.1.0.
consider using ConstraintLayout and associated layouts instead.

49 questions
0
votes
1 answer

ImageView set within PercentRelativeLayout won't show up

I try to create a complex Layout with different images included within PercentRelativeLayout. Actually I can't manage to show up an ImageView I would like to set its width to a percentage of the total width (parent width). Hereunder is my…
0
votes
1 answer

Android percent support library not producing results

I am trying to use the Android percent support library so that I can set the margins of my imageVIews proportional to the screen size. Doing so has no effect on the margins of the imageViews. Here is my XML file:
0
votes
1 answer

Android PercentRelativeLayout in a ListView shows nothing

I am trying to build a ListView with PercentRelativeLayout, but it draws nothing. I'm using Genymotion's custom phone with andoird 4.4.4 (API level 19). When I switch to RelativeLayout of LinearLayout the items appear. In PercentRelativeLayout, it…
dotaneli
  • 45
  • 11
0
votes
1 answer

Can't make android studio identify PercentageRelativeLayout

I'm trying to use PercentRelativeLayout but gradle won't find the fine the relevant resource identifier. This is my layout (simple item in list view)
1 2 3
4