[已解决]我不得不向ScrollView添加
android:fillViewport =“true”,修复了文本没有垂直居中的问题.
我知道之前已经多次回答,但我仍然无法垂直居中查看textview的文本.
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:id="@+id/relativelayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:id="@+id/icon"
android:layout_width="@dimen/icon_width"
android:layout_height="@dimen/icon_height"
android:src="@drawable/picture" />
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"/>
通常这应该适用
android:gravity="center_vertical"
但它对textview没有影响……
奇怪的是,我有第二个应用程序具有完全相同的代码,它在那里工作没有任何问题.
/编辑
澄清我的问题:
这就是我现在所拥有的:
这就是我要的: