android - View alignment attribute settings result in weird layout positioning -


in main activity defined subview layout file below (orangeview , greenview both extending viewgroup):

<?xml version="1.0" encoding="utf-8"?> <android.support.percent.percentrelativelayout 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="match_parent"     android:layout_height="250dip"     android:orientation="vertical"     android:background="@android:color/transparent"     tools:showin="@layout/activity_main">      <android.support.percent.percentrelativelayout         android:id="@+id/wrapperview"         app:layout_heightpercent="50%"         app:layout_widthpercent="90%"         android:layout_marginbottom="12dp"         android:layout_alignparentbottom="true"         android:layout_centerhorizontal="true"         android:background="@android:color/holo_blue_light">          <com.mydomain.orangeview             android:id="@+id/orangeview"             app:layout_heightpercent="100%"             app:layout_aspectratio="100%"             android:background="@android:color/holo_orange_dark"             android:layout_alignparentleft="true">              <include                 layout="@layout/view_circularview"></include>          </com.mydomain.orangeview>          <com.mydomain.greenview             android:id="@+id/greenview"             app:layout_heightpercent="70%"             app:layout_aspectratio="210%"             android:background="@android:color/holo_green_light"             android:layout_centervertical="true"             android:layout_alignparentright="true">              <include                 layout="@layout/view_redview" />          </com.mydomain.greenview>      </android.support.percent.percentrelativelayout>      <imageview         android:id="@+id/backgroundimageview"         android:layout_width="wrap_content"         android:layout_height="wrap_content" />  </android.support.percent.percentrelativelayout> 

on other hand, both subviews, namely orangeview , redview empty linearlayout below:

<linearlayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@android:color/holo_red_dark">  </linearlayout> 

and resulting layout:

enter image description here

which not expected, redview should fitting greenview orangeview.

while testing behaviour, if layout_alignparentright in greenview changed layout_alignparentleft, subview fit horizontally, still not fitting vertically, like:

enter image description here

on other hand, if layout_alignparentleft of orangeview changed layout_alignparentright, circular view's position become weird red view (the blue bordered view), is:

enter image description here

i confused , have no idea how views' positioning behave this. did wrong , how can layout them desired?

thanks!


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -