Andriod Studio使用layer-list修饰输入框

一、新建.xml文件

  • 在res中新建resourcefile
    在这里插入图片描述
    在这里插入图片描述

  • 代码:
    在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
   <item>
       <shape android:shape="rectangle">
           <solid android:color="#80ffffff"/>
           <stroke android:width="1dp" android:color="#000000"/>
           <corners android:radius="18dp"/>
       </shape>
   </item>
</layer-list>

二、编辑activity_main.xml文件

  • 代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/background1"/>
        <EditText
            android:layout_width="150dp"
            android:layout_height="50dp"
            android:background="@drawable/edit_style"
            android:gravity="center"
            android:hint="用户账号"
            android:textColor="#000000"
            android:textSize="25sp"
            android:layout_gravity="bottom"
            android:layout_marginLeft="45dp"
            android:layout_marginBottom="75dp"/>

        <ImageView
            android:id="@+id/iv_play"
            android:layout_width="115dp"
            android:layout_height="102dp"
            android:layout_gravity="bottom|right"
            android:layout_marginRight="50dp"
            android:layout_marginBottom="50dp"
            android:src="@drawable/user" />
    </FrameLayout>


</LinearLayout>
  • 在drawable文件中添加的背景图片为background1与user。

三、效果

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值