1

I have an adapter class in which I have a layout

<android.support.percent.PercentRelativeLayout
    android:id="@+id/relayout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:layout_margin="5dp">
    <ImageView
        android:id="@+id/imageView"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_heightPercent="40%"
        app:layout_widthPercent="25%"
        android:src="@drawable/fairytail_button_selector"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true" />

    <TextView
        android:id="@+id/txtlabel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/imageView"
        android:layout_centerHorizontal="true"
        android:textColor="@android:color/white" />

</android.support.percent.PercentRelativeLayout>

I am using percentage library to make UI same on all devices but its show nothing when I run this on my mobile device, I am using same library for my other layouts it works perfectly but when I call this layout in adapter class in getview method it display nothing. But if I use simple Relative layout instead of android.support.percent.PercentRelativeLayout it shows everything fine please help me what I am doing wrong

Terence Eden
  • 14,034
  • 3
  • 48
  • 89
  • Why use percent layout? To show it identically on all devices use `RelativeLayout`, `FrameLayout` or `CoordinatorLayout`, and use `dp` as unit. Dp are density pixels, so it does not matter which resolution/screen size the device has. – xdevs23 Feb 23 '16 at 12:08
  • using these layout we do not show same image same size look on different screens ... if we do not use percentlayout then we have to create different layouts for different screens.... read my question carefully – Android Love Feb 23 '16 at 12:13
  • Sure, do what you want but I don't know how to solve your problem, maybe post a little code example. – xdevs23 Feb 23 '16 at 14:32

0 Answers0