Issue
Okay, so all I am trying to do is set four circles up in a linear layout. The problem is the circles show up as ovals. I have tried not setting width and height in the circle.xml files, I have tried setting width of the circles in the view to 0dp, wrap_content and 50dp to match the height, still, ovals. I have tried not setting the weightSum in the layout with the same result, it's like it doesn't need to be there.
LinearLayout
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="200dp"
android:paddingRight="@dimen/xlarge_padding"
android:paddingLeft="@dimen/xlarge_padding"
android:orientation="horizontal"
android:weightSum="4">
circle_blue.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size
android:width="50dp"
android:height="50dp" />
<solid android:color="@color/fc_blue"/>
I am calling the circles with Views that have the width set to 0dp and the height to 50dp, and the layout_weight to 1 with the background set to circle_xxx.xml.
Should I just ditch the weight settings and use padding to space them apart?
Here is a screenshot of how they look on device
https://www.dropbox.com/s/afh8d8m3jrbhrzf/Screenshot_2015-09-27-06-35-07.png?dl=0
Solution
That's the effect of using weights.
I guessed that, because you used the (useless) weightSum
attribute in the LinearLayout.
Now, weights actually modify the children Views dimensions, which are no more 50dp in width, while they maintain 50dp in height.
This is why you get ovals, instead of circles.
Answered By - Phantômaxx
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.