Working with a `PercentRelativeLayout` (PRL from now on) to scale either `ImageViews` or `Buttons` based on screen size.
On the emulator running API 23, and on the XML preview API 23 - it looks and works beautifully. However when changing to any other API, including API 24 (or 16, etc), there is no display from `Button` or `ImageView`. Oddly enough `textView` will still show.
Done so far:
* Updated appropriate Android Studio patches (do all APIs need to be installed?)
* Added `compile 'com.android.supportercent:24.0.0'` to gradle build
* Attempt a load on physical device (phone running API 16 and one API 17) with no luck
Really getting confused by this one. Any support appreciated. Really would love the simple solution as opposed to setting view percentages programatically.
Thanks
Narrowed down to not a problem with the physical device but with the API version itself. Have yet to find a solution as to how to make PRL visible across multiple APIs at least down to 16 and up to 24.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android: paddingBottom="@dimen/activity_vertical_margin"
android: paddingLeft="@dimen/activity_horizontal_margin"
android: paddingRight="@dimen/activity_horizontal_margin"
android: paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@String/appbar_scrolling_view_behavior"
tools:context="com.example.y"
tools:showIn="@layout/app_bar_main"
android:background="#FFF"
android:weightSum="1"
android: orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:scrollIndicators="top">
<android.support.percent.PercentRelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="This text appears correctly"
android:textSize="28sp"
android:id="@+id/textMainTitle"
android:layout_gravity="center"
android:layout_alignParentTop="true"
android:textColor="#ffffff"
android:singleLine="true"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="As does this text"
android:id="@+id/textMainSubTitle"
android:layout_gravity="center_horizontal"
android:layout_below="@id/textMainTitle"
/>
<ImageView //DOES NOT APPEAR UNLESS API23
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/btnIntro"
android:src="@drawable/button1"
app:layout_widthPercent="30%"
app:layout_heightPercent="25%"
android:layout_below="@id/textMainSubTitle"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp" />
</android.support.percent.PercentRelativeLayout>
</ScrollView>
</LinearLayout>
On the emulator running API 23, and on the XML preview API 23 - it looks and works beautifully. However when changing to any other API, including API 24 (or 16, etc), there is no display from `Button` or `ImageView`. Oddly enough `textView` will still show.
Done so far:
* Updated appropriate Android Studio patches (do all APIs need to be installed?)
* Added `compile 'com.android.supportercent:24.0.0'` to gradle build
* Attempt a load on physical device (phone running API 16 and one API 17) with no luck
Really getting confused by this one. Any support appreciated. Really would love the simple solution as opposed to setting view percentages programatically.
Thanks
Narrowed down to not a problem with the physical device but with the API version itself. Have yet to find a solution as to how to make PRL visible across multiple APIs at least down to 16 and up to 24.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android: paddingBottom="@dimen/activity_vertical_margin"
android: paddingLeft="@dimen/activity_horizontal_margin"
android: paddingRight="@dimen/activity_horizontal_margin"
android: paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@String/appbar_scrolling_view_behavior"
tools:context="com.example.y"
tools:showIn="@layout/app_bar_main"
android:background="#FFF"
android:weightSum="1"
android: orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:scrollIndicators="top">
<android.support.percent.PercentRelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="This text appears correctly"
android:textSize="28sp"
android:id="@+id/textMainTitle"
android:layout_gravity="center"
android:layout_alignParentTop="true"
android:textColor="#ffffff"
android:singleLine="true"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="As does this text"
android:id="@+id/textMainSubTitle"
android:layout_gravity="center_horizontal"
android:layout_below="@id/textMainTitle"
/>
<ImageView //DOES NOT APPEAR UNLESS API23
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/btnIntro"
android:src="@drawable/button1"
app:layout_widthPercent="30%"
app:layout_heightPercent="25%"
android:layout_below="@id/textMainSubTitle"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp" />
</android.support.percent.PercentRelativeLayout>
</ScrollView>
</LinearLayout>