[Solved] I had to add android:fillViewport="true"
to the ScrollView, that fixed the problem with the text not centering vertically.
I know this has been answered many times before, but I´m still not able to center a textview´s text vertically.
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/relativelayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/icon"
android:layout_width="@dimen/icon_width"
android:layout_height="@dimen/icon_height"
android:src="@drawable/picture" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/icon"
android:gravity="center_vertical"
android:layout_alignBottom="@+id/icon"
android:layout_alignTop="@+id/icon"
android:text="@string/title_text"
android:textSize="@dimen/textsize"
android:textStyle="bold"
android:textColor="@color/color"
android:shadowColor="@color/shadow"
android:shadowRadius="5"/>
</RelativeLayout>
</ScrollView>
Normally this should work with
android:gravity="center_vertical"
but it has no effect on the textview...
Weird thing is that I have a second app with the exact same code and it´s working there without any problems.
/edit
To clarify my question:
This is what I have right now:
This is what I want:
replace your TextView with this code and it will work fine
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/icon"
android:layout_alignParentTop="true"
android:layout_alignTop="@+id/icon"
android:layout_toRightOf="@+id/icon"
android:shadowColor="@color/shadow"
android:shadowRadius="5"
android:text="@string/title_text"
android:textColor="@color/color"
android:textSize="@dimen/textsize"
android:textStyle="bold" />