在ImageView上添加Button并为图片做填充和为Button按钮设置透明度

论坛 期权论坛 脚本     
匿名技术用户   2020-12-29 01:15   33   0

1.使用FrameLayout布局可以在ImageView上放Button

2.使用Android:scaleType=“fitxy”设置图片填充

<FrameLayout      //布局
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <Button
        android:id="@+id/button1"
        android:layout_width="60dp"
        android:layout_height="40dp"
        android:layout_marginLeft="280dp"
        android:layout_marginTop="20dp"
        android:textColor="#ff0000"
        android:onClick="splash"
        android:text="跳过" />
    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:scaleType="fitXY"         //填充屏幕
        app:srcCompat="@mipmap/img_splash1" />
</FrameLayout>
3:为Button设置透明度在(XXXActivity)你的方法

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP