zoukankan      html  css  js  c++  java
  • 【家庭记账本】Android开发日记(三)

      今日熟悉了android studio中的其他常用控件,以及线性布局的嵌套使用。

      Android Studio中控件不只是textview(文本),button(按钮),还有输入框,插入图片等控件。其中在学习插入图片时我认识了drawable文件夹,这个文件夹是用来存放图片的,使用时直接通过android:src="@drawable/图片名称"即可调用,以下是练习时写下的代码

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:gravity="center_horizontal"
        tools:context=".MainActivity">
    
        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:text="Hello World!"
            />
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="这是一个按钮"
            />
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="下面是一个输入框"
            />
    
        <EditText
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            />
    
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="right">
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="嵌套后的按钮"
            />
            </LinearLayout>
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp"
            android:textSize="50dp"
            android:text="插入图片"
            />
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/picture1"
            />
    </LinearLayout>

    使用模拟器打开的界面效果不太一样,先附上手机样式的图片效果:

     使用虚拟机的演示效果(在输入框里写入文本)

  • 相关阅读:
    【NLP_Stanford课堂】最小编辑距离
    【NLP_Stanford课堂】句子切分
    【NLP_Stanford课堂】词形规范化
    【NLP_Stanford课堂】分词
    【NLP_Stanford课堂】正则表达式
    【Python自然语言处理】第一章学习笔记——搜索文本、计数统计和字符串链表
    【C++ Primer】详解C++和C中的float中的有效数字
    【C++ Primer】读书笔记_第一章
    【SQL Server 2012】按倒序存储“分组统计”结果的临时表到新建表
    Git学习
  • 原文地址:https://www.cnblogs.com/20183711PYD/p/12261089.html
Copyright © 2011-2022 走看看