我有一个关于SDK 18的问题。
我的文本视图的重力在垂直方向上不起作用。但是在SDK17上可以工作。
图片和代码:
header_of_listView.xml:
图片和代码:
header_of_listView.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/iv_bg"
android:layout_width="wrap_content"
android:layout_height="@dimen/entete.size.h"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:contentDescription="@string/blank"
android:scaleType="fitXY"
android:src="@drawable/cellule_flecher_mise_en_valeur" />
<TextView
android:id="@+id/tv_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/iv_bg"
android:layout_alignLeft="@id/iv_bg"
android:layout_alignRight="@id/iv_bg"
android:layout_alignTop="@id/iv_bg"
android:layout_marginBottom="6dp"
android:gravity="center"
android:text="@string/a_remplacer"
android:textColor="@color/tableviewText"
android:textSize="18sp"
android:textStyle="bold"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
AndroidManifest.xml
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
AndroidManifest.xml
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
使用黑色背景的TextView android:background="#000000"
如果有人有想法。 我已经尝试将wrap_content更改为match_parent。
唯一有效的方法是在TextView上使用android:layout_height="@dimen/entete.size.h",但是边距不适用。 目前我将项目保留到SDK 17。