android ImageView 悬浮文字是怎么实现,类似礼物说app

发布网友

我来回答

1个回答

热心网友

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="256dp"
android:layout_margin="16dp"
android:background="@android:color/background_dark" >

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/app_name"
android:scaleType="fitXY"
android:src="@drawable/demo" />

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:textColor="@android:color/black"
android:textSize="24sp"
android:layout_gravity="bottom|center_horizontal" />

<FrameLayout
android:layout_gravity="end|top"
android:layout_width="dp"
android:layout_height="24dp"
android:background="@android:color/background_light"
android:alpha="0.5" >

<ImageView
android:layout_width="24dp"
android:layout_height="match_parent"
android:contentDescription="@string/app_name"
android:scaleType="centerInside"
android:src="@android:drawable/ic_menu_delete"
android:layout_gravity="start|center_vertical" />

<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end|center_horizontal"
android:gravity="end|center_vertical"
android:text="1234"
android:textColor="@android:color/black"
android:textSize="14sp" />

</FrameLayout>

</FrameLayout>

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com