RelativeLayout android:重力不在api 16以下使用?
我写信是为了显示视频的名称和标记RelativeLayout android:重力不在api 16以下使用?,android,android-relativelayout,Android,Android Relativelayout,我写信是为了显示视频的名称和标记 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="left"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:paddingBottom="7dp" >
<TextView
android:id="@+id/drama_mark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:includeFontPadding="false"
android:textColor="#ff9313"
android:textSize="16dp"
android:layout_marginLeft="8dp"
android:text="8.8"/>
<TextView
android:id="@+id/drama_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:gravity="left|end"
android:textColor="#ff323232"
android:textSize="16dp"
android:text="See you again"
android:layout_toLeftOf="@id/drama_mark" />
</RelativeLayout>
但是它没有在android 16下使用。为什么它显示在右边?视频,名字可能是两行或更多行。我已经尝试了很多次,请帮助我。
试试这个:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:paddingBottom="7dp" >
<TextView
android:id="@+id/drama_mark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:textColor="#ff9313"
android:layout_alignParentRight="true"
android:textSize="16dp"
android:layout_marginLeft="8dp"
android:text="8.8"/>
<TextView
android:id="@+id/drama_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:gravity="left|start"
android:textColor="#ff323232"
android:layout_alignParentLeft="true"
android:textSize="16dp"
android:layout_toLeftOf="@+id/drama_mark"
android:text="See you again gbfayufbafubsayfbas fysgafysaf fyasgfysuafas" />
</RelativeLayout>
试试这个:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:paddingBottom="7dp" >
<TextView
android:id="@+id/drama_mark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:textColor="#ff9313"
android:layout_alignParentRight="true"
android:textSize="16dp"
android:layout_marginLeft="8dp"
android:text="8.8"/>
<TextView
android:id="@+id/drama_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:gravity="left|start"
android:textColor="#ff323232"
android:layout_alignParentLeft="true"
android:textSize="16dp"
android:layout_toLeftOf="@+id/drama_mark"
android:text="See you again gbfayufbafubsayfbas fysgafysaf fyasgfysuafas" />
</RelativeLayout>
最后我用
表格布局来解决我的问题
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="@dimen/distance"
android:paddingBottom="7dp"
android:shrinkColumns="0">
<TableRow>
<TextView
android:id="@+id/drama_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:textColor="#ff323232"
android:text="see you again"
android:textSize="16dp" />
<TextView
android:id="@+id/drama_mark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:includeFontPadding="false"
android:textColor="#ff9313"
android:textSize="@dimen/big_text"
android:layout_marginLeft="16dp"
android:text="8.8" />
</TableRow>
</TableLayout>
最后我用表格布局来解决我的问题
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="@dimen/distance"
android:paddingBottom="7dp"
android:shrinkColumns="0">
<TableRow>
<TextView
android:id="@+id/drama_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:textColor="#ff323232"
android:text="see you again"
android:textSize="16dp" />
<TextView
android:id="@+id/drama_mark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:includeFontPadding="false"
android:textColor="#ff9313"
android:textSize="@dimen/big_text"
android:layout_marginLeft="16dp"
android:text="8.8" />
</TableRow>
</TableLayout>
要在左侧显示吗?重力早在16岁之前就存在了。@Mustansarsaed我希望戏剧名称右侧有戏剧标记,戏剧名称可能有很多行。@Gabeschen但它没有显示我想要的内容。它在16年后很好地工作。使用android:layout\u width=“match\u parent”作为您要在左侧显示的戏剧名称?重力早在16年前就存在了。@Mustansaseed我希望戏剧名称右侧有戏剧标记,戏剧名称可能有很多行。@Gabeschen但它没有显示我想要的内容。它在16分钟后运行良好。对您的戏剧名称使用安卓:layout\u width=“match\u parent”,但当戏剧名称较短时,它在api 16以下不起作用,但当戏剧名称较短时,它在api 16以下不起作用