zoukankan      html  css  js  c++  java
  • Android Studio 学习(二) UI

    TextView

    • android:gravity="center"居中对齐 //文字对齐方式

    • top bottom left right center

    • android:textSize="24sp"

    • android:textColor="#ffffff"

    Button

    • textAllCaps="false"禁止自动转换为大写

    EditText 输入框

    • hint="Type something here" 提示文字
    • maxLines="2" 最大行数 当超过两行时 出现滚动条

    imageView

    • 图片放在drawable里
    • src="@drawable/img_1"

    ProgressBar 进度条

    • visibility:visible invisible gone //不占用空间
    • progressBar.getVisibility()
    • progressBar.setVisibility(View.VISIBLE INVISIBLE GONE)
    • style =" >android:attr/progressBarStyleHorizontal" //水平进度条 默认为圆形进度条
    • max=“100”//进度条长度
    • 改变进度条的长度int progress=progressBar.getProgress(); progress=progress+10; progressBar.setProgress(progress1;)

    AlertDialog 确认对话框

    • 直接在代码中实现
      AlterDialog.Builder dialog=new AlterDialog.Builder(MainActivity.this);
      dialog.setTitle("This is Dialog")
      dialog.setMessage("something important")
      dialog.setCancelable(false)//需要用dissmiss来关闭对话框
      dialog.setPositiveButton("OK",new DialogInerface.OnClickListener())
      {
      }
      dialog.setNegativeButton(){}
      dialog.show();

    ProgressDialog//显示等待进度条

    代码与上面的类似

    布局

    线性布局LinearLayout

    • orientation:vertical/horizontal 排列方向
    • layout_gravity="top center_vertical bottom" 排列对齐方式
    • layout_weight=1 一行的屏幕占比

    相对布局RelativeLayout

    p100

    帧布局FrameLayout

    百分比布局PercentLayout

    ConstraintLayout

    https://blog.csdn.net/guolin_blog/article/details/53122387

  • 相关阅读:
    CREATE VIEW
    CREATE USER
    安全层次
    PHP json_decode 函数解析 json 结果为 NULL 的解决方法
    Java实现 LeetCode 7整数反转
    Java实现 LeetCode 6 Z字形变换
    Java实现 LeetCode 6 Z字形变换
    Java实现 LeetCode 6 Z字形变换
    Java实现 LeetCode 5 最长回文子串
    Java实现 LeetCode 5 最长回文子串
  • 原文地址:https://www.cnblogs.com/lancelee98/p/9443701.html
Copyright © 2011-2022 走看看