Bogdan Daniel February 2016

Custom layout android

I'm trying to create the following design enter image description here

I sort of did it by using PercentRelativeLayout for layouts and AutoResizeTextView for those TextViews, but I ended up with over 10 layouts and I can see that the layout is very slow being rendered. The main problem were the images because I could get them to do what I want only by doing this sort of things:

<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="wrap_content"
                        android:layout_height="match_parent"
                        android:layout_toLeftOf="@+id/buttonright1layout"
                        android:layout_centerVertical="true"
                        app:layout_heightPercent="40%">

                        <name.company.newapp.PostForm.SelectPhoto.SquareRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentRight="true"
                            android:layout_centerInParent="true">

                            <de.hdodenhof.circleimageview.CircleImageView
                                android:id="@+id/btnright2"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:src="@drawable/me" />
                        </name.company.newapp.PostForm.SelectPhoto.SquareRelativeLayout>
                    </android.support.percent.PercentRelativeLayout>

Could

Answers


Gavriel February 2016

I think android:layout_weight is what you're after


thetonrifles February 2016

There's no problem if you don't specify textSize for TextView. Default value is used.

You can set ImageView width and height in dp without problems. In such case it would be useful to specify a value for scaleType attribute for preventing images to be rendered in a bad way.

Post Status

Asked in February 2016
Viewed 3,195 times
Voted 4
Answered 2 times

Search




Leave an answer