几行代码做出引导页效果

完整代码:

<html>
<head>
    <meta charset="UTF-8">
    <title>引导页演示</title>
    <script src="js/jquery.min.js"></script><!--引用jq-->
    <style>
    #ydy{
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 999;
        background: url(img/ydy.png) 0% 0% /100% 100% no-repeat;  /*引用引导页图片*/
    }
    </style>
</head>
<body>
    <div id="ydy" style="display: none;">
        <button type="button" style="float:right;color: #6c757d;border-color: #6c757d;" id="btn1">跳过</button>
    </div>
    <script>
        window.onload =function(){
            $('#ydy').show();
            btn1.onclick=function(){
                $('#ydy').hide();
                window.location.href="index.php";  
            }
            setTimeout(function() {
                $('#ydy').hide();
                window.location.href="index.php";  
            }, 5000);
        }
    </script>
</body>
</html>

按钮样式没写有点丑,各位看官可自行修改。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
以下是一个简单的安卓引导代码: 布局文件: ```xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/colorPrimary"> <ImageView android:id="@+id/imageView" android:layout_width="200dp" android:layout_height="200dp" android:layout_centerInParent="true" android:src="@drawable/logo" /> <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/imageView" android:layout_centerHorizontal="true" android:textColor="@android:color/white" android:textSize="18sp" android:text="Welcome to my app" /> <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/textView" android:layout_centerHorizontal="true" android:layout_marginTop="20dp" android:text="Get Started" /> </RelativeLayout> ``` Activity代码: ```java public class IntroActivity extends AppCompatActivity { private Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_intro); button = findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //在这里处理按钮点击事件 } }); } } ``` 这个布局文件包含一个ImageView显示应用程序的logo,一个TextView显示欢迎消息,一个Button开始按钮。在Activity中,我们可以使用findViewById()方法获取这些视图并设置点击事件处理程序。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小凡全栈

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值