Okan
Okan

Reputation: 1389

Vertical alignment in linearlayout

I have a linear layout,like this:

enter image description here

You can see I have an arrow on the left side.It should point to Message but you see it is top of the Message How can I align it like this :

enter image description here

My xml:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:paddingBottom="4dp"
              android:paddingTop="4dp"
              android:orientation="horizontal"
              android:layout_width="match_parent"
              android:layout_height="wrap_content">

    <ImageView
            android:id="@+id/image"
            android:layout_width="64dp"
            android:layout_height="64dp"
            android:src="@drawable/defaultprofile"/>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical"
        android:paddingLeft="4dp"
        android:paddingRight="4dp" >

        <TextView
            android:id="@+id/tweet"
            style="@android:style/TextAppearance.Medium"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:textColor="#0A0A14" 
            android:layout_marginLeft="8dp"
            android:textSize="15sp"
            android:text="Tolgay Toklar"
            android:fontFamily="sans-serif-condensed"
            />
    <ImageView
            android:id="@+id/ok"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/sagokgri"/>
        <TextView
            android:id="@+id/bio"
            style="@android:style/TextAppearance.Small"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:textColor="#474747" 
            android:layout_marginLeft="8dp"
            android:maxLines="3"
            android:text="Message"
            android:textSize="11sp"
            android:layout_marginTop="0dp"/>



    </LinearLayout>
    <ImageView
 android:id="@+id/image1"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_gravity="right|center_vertical"

 android:src="@drawable/anchor" />
</LinearLayout>

Upvotes: 3

Views: 52

Answers (1)

frogatto
frogatto

Reputation: 29287

Remove that ImageView and use it like drawableLeft, something like this:

<TextView
    ...
    android:text="Message"
    android:drawableLeft="@drawable/sagokgri"
    .../>

Upvotes: 6

Related Questions