0
我想将水平方向上的TextView
与RelativeLayout
对齐。 尝试所有的选项,你可以看到下面,但没有一个似乎有所作为。仅在水平方向上对齐RelativeLayout中的TextView
唯一不同的是android:layout_centerInParent="true"
但是这个问题是它也垂直居中,但我只是想横向。
请建议。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayoutFragment"
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/userLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/marginOne"
android:background="#80000000"
android:gravity="center"
android:padding="@dimen/marginOne"
android:text="@string/findingLocation"
android:textColor="#FFFFFF"
android:textSize="@dimen/FontTwo" />
</RelativeLayout>
没有变化,都一样。 – Maven
@Maven你确定,它工作正常..看上面,看看编辑 –