Reputation: 2749
I'm trying to create the following design
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 anyone suggest a better approach?
Update:
The loading was caused by a large drawable that I had as a background. I removed it and now it's working fine.Since this thread is here I have a few questions about this design:
Will there be any problems if I don't set the size of the TextViews/set it in sp
?(textSize
)
<TextView
android:id="@+id/date_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Text4"
android:textColor="#fff" />
Will there be any problems if I set the size of the ImageViews in dp
?
<ImageView
android:id="@+id/img_5"
android:layout_width="@dimen/img_size"
android:layout_height="@dimen/img_size"
android:layout_centerInParent="true"
android:background="@drawable/nexticn" />
Upvotes: 0
Views: 83
Reputation: 4147
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.
Upvotes: 1