重新开始第一天。。。。

Android

Toast类 简易的消息提示框

  1. 用法:通过静态方法makeText()创建出一个Toast对象,然后调用show()将Toast显示出来即可

Toast.makeText(Context context, CharSequence text, int duration).show();
  1. makeText()方法的三个参数

  • 第一个参数Context,也就是Toast要求的上下文,由于活动本身即是一个Context对象,因此直接传入当前活动即可

  • 第二个参数即要显示的文本

  • 第三个参数即Toast要显示的时长   

    • Toast.LENGTH_SHORT

    • Toast.LENGTH_LONG

Toast.makeText(MainActivity.this,"You clickedButton",Toast.LENGTH_SHORT).show();

Intent类     用于不同活动间的跳转

显式

  • 用法:直接在对应类中调用

Intent intent = new Intent(Context packageContext,Class<?>cls)
Intent intent = new Intent(MainActivity.this,SecondActivity.class);

-Context要求提供一个启动活动的上下文

-Class则是指定要启动的目标活动

隐式

  • 若使用android.intent.category.DEFAULT默认的用法:

    要先在AndroidManifest中在对应的活动声明中添加<action><category>标签并输入该活动可响应的字符串,如果两个都字符串都对应其可响应的字符串则这个活动才能响应Intent。

<activity android:name=".SecondActivity">
  <intent-filter>
      <action android:name="com.example.activitytest.ACTION_START"/>
      <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
</activity>
Intent intent = new Intent("com.example.activitytest.ACTION_START");

-<action>标签中字符串可任意而<category>标签则不行。

-在上面的android.intent.category.DEFAULT 是一种默认的category,在调用startActivyty()方法的时候自动将category添加到Intent

-每个Intent中只能指定一个action但能指定多个category

  • 若category不使用默认的android.intent.category.DEFAULT的用法:

    在AndroidManifest中再加一个<category>标签其中写上任意字符串然后在对应类中调用addCategory()方法即可

<activity android:name=".SecondActivity">
    <intent-filter>
        <action android:name="com.example.activitytest.ACTION_START"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="com.example.activitytest.MY_CATEGORY"/>
    </intent-filter>
</activity>
Intent intent = new Intent("com.example.activitytest.ACTION_START");
intent.addCategory("com.example.activitytest.MY_CATEGORY");
最后将建好的intent参数传入方法startActivity()方法中即可

标签

<item>标签是用来创建一个具体的菜单项

  1. 用法:在res下创建一个 menu的文件夹 再在其下创建一个 菜单资源文件(menu resource file  在其中创建菜单项,后在对应的类中重写onCreateOptionsMenu()方法,在方法中用getMenuInflater()方法得到MenuInflater对象,再调用它的inflate()方法就可以给当前活动创建菜单项。

  • 在创建的menu resource file中

    <item
      android:id="@+id/add_itm"
      android:title="ADD"/>
  <item
      android:id="@+id/remove_item"
      android:title="Remove"/>
  • 在对应类中

        MenuInflater menuInflater = getMenuInflater();
      menuInflater.inflate(R.menu.main,menu);
      return true;
       
      //or
       
      getMenuInflater().inflatr(R.menu.main,menu)

- inflater()方法中有两个参数,一个是通过哪个资源文件来创建菜单,第二个参数是创建的菜单添加到哪个Menu对象中。

HTML

HTML的基本结构

  1. DOCTYPE  告诉浏览器我们要使用什么规范

  2. <head>   </head>        网页的头部     <meat>    描述标签一般用来做SEO
  3. <title>写网页标题</title>            网页标题写在头部中
  4. <body>   </body>        网页的主体

网页的基本标签

  1. 标题标签      

<h1></h1>       一级标签
<h2></h2> 二级标签
<h3></h3> 三级标签
  1. 段落标签

<p> 内容  </p>
  1. 换行标签

   内容   <br>
  1. 水平线标签

<hr/>
  1. 注释

<!--  内容   -->
  1. 特殊符号

查百度

 

英语单词

  • match   v.相匹

  • warp     vi.包起来,缠绕

  • concent     n.内容

  • create      vt.创造,创作

  • options     n.选择

  • menu     n.菜单

  • selected    v.(从菜单中)选择     select的过去式及过去分词

 

posted @ 2020-08-09 21:42  陈强强强强强  阅读(120)  评论(0)    收藏  举报