Tuesday, 27 August 2013

center align imageview with above textview

center align imageview with above textview

I want to center align my imageview with the above textview here's an
image of what I'm getting.

I need something like this in a relative layout
<TextView
android:id="@+id/strength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/hero_class"
android:textColor="#0095FF"
android:text="Strength"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/agility"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/hero_class"
android:layout_centerHorizontal="true"
android:text="Agility"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#0095FF" />
<TextView
android:id="@+id/intl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/agility"
android:layout_alignBottom="@+id/agility"
android:layout_alignParentRight="true"
android:text="Intelligence"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#0095FF" />
<ImageView
android:id="@+id/img_int"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/img_str"
android:src="@drawable/intelligence" />
<ImageView
android:id="@+id/img_agi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/img_int"
android:layout_centerHorizontal="true"
android:src="@drawable/agility" />
<ImageView
android:id="@+id/img_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/strength"
android:layout_alignParentLeft="true"
android:src="@drawable/strength" />
This is what i have done but the problem is that i can have the middle
imageview centered align but the left and right one are with align to the
most right and most left not in the center of above textview

No comments:

Post a Comment