zoukankan      html  css  js  c++  java
  • 每日日报2021.4.5

    今天完成内容:

    学习andriod button

     按钮(Button)应该是用户交互中使用最多的组件,在很多应用程序中都很常见。当用户单击按钮的时候,会有相对应的响应动作。

    下面在 WidgetDemo 工程的主界面 main.xml 中放置一个名为 Button 的按钮。文件代码如

    <?xml version="1.0" encoding="utf-8"?>

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:orientation="vertical">

    <TextView

    android:layout_width="fill_parent"

    android:layout_height="wrap_content"

    android:text="@string/hello" />

    <Button

    android:id="@+id/button1"

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:text="Button" />

    </LinearLayout>

     package introduction.android.widgetdemo;

    import android.support.v7.app.AppCompatActivity;

    import android.os.Bundle;

    import android.util.Log;

    import android.view.View;

    import android.widget.Button;

    public class MainActivity extends AppCompatActivity {

        @Override

    protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    Button btn = (Button) this.findViewById(R.id.button1);

            btn.setOnClickListener(new View.OnClickListener() {

                @Override

    public void onClick(View v) {

    //TODO Auto-generated method stub

    setTitle("button1 被用户点击了");

                    Log.i("widgetDemo", "button1 被用户点击了。");

    }

    });

    }

    }

    看视频

    遇到问题:

    明日目标:

    学习Android studio的开发

  • 相关阅读:
    【nodejs】vscode添加nodejs调试功能
    【nodejs】简单的httpserver
    windows下,强制关闭某端口号的进程
    git 客户端用户名密码配置
    【shell】变量替换
    aksk鉴权
    vue学习笔记-第一课
    好未来上海一面电面
    20190325面试题记录(中级java)
    IT帮-三月份-职业规划主题笔记
  • 原文地址:https://www.cnblogs.com/leiyu1905/p/14909933.html
Copyright © 2011-2022 走看看