Nilesh Patidar
Nilesh Patidar

Reputation: 32

Trouble in Layout design Android

I have created an Android Application in that I have problem in Layout design.

Please see layout in this link-

https://lh6.googleusercontent.com/WJRLolp6PVoKskRBdFH6VMmdqftSgt10EZhd-A1h_glblYoJjVrF8bYjsPXmw752sGttlzIh7IHwtQo=w1342-h479

My code:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <ImageView
            android:id="@+id/product_image"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/product" />

        <TextView
            android:id="@+id/price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/product_image"
            android:layout_alignParentRight="true"
            android:text="Price"
            android:textAppearance="?android:attr/textAppearanceLarge" />
    </RelativeLayout>

    <ImageView
        android:id="@+id/user_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/userimage" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="right"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/distance"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Distance"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <TextView
            android:id="@+id/time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Time"
            android:textAppearance="?android:attr/textAppearanceMedium" />
    </LinearLayout>
</LinearLayout>

Thanks.

Upvotes: 1

Views: 132

Answers (2)

nvinayshetty
nvinayshetty

Reputation: 3237

    <ImageView
    android:id="@+id/user_image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingLeft="5dp"
    android:layout_marginTop="-25dp"
    android:src="@drawable/ic_launcher" />

change the user image xml to above code and try

Upvotes: 1

N J
N J

Reputation: 27505

You can use the Relative layout for that

or

you can make it custom layout

http://www.vogella.com/tutorials/AndroidCustomViews/article.html

Upvotes: 0

Related Questions