Reputation:
Trying create a XML file for ListView item like this:
Here I didn't how to create a XML file for this UI. I tried by taking two TextViews (Left blue box content) in one LinearLayout and remaining content(right blue box content) in one RelativeLayout. I didn't get how to place two layouts side by side. if my approach is wrong then please suggest suitable solution.
Upvotes: 1
Views: 953
Reputation: 2387
Your approach was good, the only thing is that you have to get the two separate layouts next to each other. You can simply put the layouts inside a LinearLayout and set the orientation to horizontal
.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!--Left box (Solved)-->
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp">
<!--Right box (Level with progressbar)-->
</RelativeLayout>
</LinearLayout>
Upvotes: 4
Reputation: 101
You can put the two layouts inside another LinearLayout with horizontal orientation.
Upvotes: 1