【发布时间】:2016-11-24 14:08:57
【问题描述】:
我想在 Button 上方显示一个 TextView,但在 API 21 中,Button 在 TextView 上方。
我尝试了android:elevation,但它给 Textview 造成了阴影,效果不好。
我尝试了android:translationZ="100dip",但没有成功。
我的 xml 代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_margin="10dp">
<Button
android:id="@+id/custom_listview_food"
android:text="@string/main_matrial1"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:padding="10dp"
android:gravity="center_horizontal"
android:textSize="16sp"
android:background="@color/listview_matrial"
android:layout_marginBottom="5dp"
/>
<TextView
android:id="@+id/custom_listview_material1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="material 1"
android:textColor="@color/white"
android:textSize="20sp"
android:layout_alignRight="@id/custom_listview_food"
android:layout_marginTop="50dp"
android:layout_marginRight="10dp"
/>
</RelativeLayout>
【问题讨论】:
标签: android android-layout button textview