tnblog
首页
视频
资源
登录

渣渣学安卓之登录摸索及页面效果实现

6564人阅读 2019/2/23 11:53 总访问:194282 评论:1 收藏:0 手机
分类: android

(背景)过完年来,一脸懵逼状态下开始的安卓学习,学错的求解勿喷。

创建了个安卓下载地址 有需要的可以直接下载安装  

链接:https://pan.baidu.com/s/1oLtvkOWgBhzelAGs1XX7lw 

提取码:qrq6 

个人感觉android studio写安卓貌似比之前的eclipse简单些,毕竟还有Design可视化视图拖拖拖,后台自动生成代码。但是也要考虑到布局,刚开始各种不懂,各种摸索。

先上demo效果图   凑合看



布局代码

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.     xmlns:app="http://schemas.android.com/apk/res-auto"
  4.     xmlns:tools="http://schemas.android.com/tools"
  5.     android:layout_width="match_parent"
  6.     android:layout_height="match_parent"
  7.     tools:context=".login_user">
  8.     <LinearLayout
  9.         android:layout_width="wrap_content"
  10.         android:layout_height="wrap_content"
  11.         android:background="@drawable/dengl_bg"
  12.         android:orientation="vertical">
  13.         <RelativeLayout
  14.             android:layout_width="match_parent"
  15.             android:layout_height="match_parent"
  16.             android:layout_marginLeft="30dp"
  17.             android:layout_marginTop="40dp"
  18.             android:layout_marginRight="30dp"
  19.             android:layout_marginBottom="10dp">
  20.             <LinearLayout
  21.                 android:layout_width="match_parent"
  22.                 android:layout_height="match_parent"
  23.                 android:orientation="vertical">
  24.                 <ImageView
  25.                     android:id="@+id/imageView16"
  26.                     android:layout_width="wrap_content"
  27.                     android:layout_height="179dp"
  28.                     app:srcCompat="@drawable/dengl_logo" />
  29.                 <EditText
  30.                     android:id="@+id/editText"
  31.                     android:layout_width="match_parent"
  32.                     android:layout_height="70dp"
  33.                     android:ems="10"
  34.                     android:inputType="textPersonName"
  35.                     android:text="请输入用户名"
  36.                     android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
  37.                 <EditText
  38.                     android:id="@+id/editText2"
  39.                     android:layout_width="match_parent"
  40.                     android:layout_height="70dp"
  41.                     android:ems="10"
  42.                     android:inputType="textPersonName"
  43.                     android:text="请输入密码"
  44.                     android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
  45.                 <RadioButton
  46.                     android:id="@+id/radioButton"
  47.                     android:layout_width="match_parent"
  48.                     android:layout_height="55dp"
  49.                     android:text="记住账号"
  50.                     android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
  51.                 <Button
  52.                     android:id="@+id/button22"
  53.                     style="@style/Widget.AppCompat.Button.Colored"
  54.                     android:layout_width="match_parent"
  55.                     android:layout_height="50dp"
  56.                     android:text="登  录"
  57.                     android:textColorLink="@color/colorAccent" />
  58.             </LinearLayout>
  59.         </RelativeLayout>
  60.     </LinearLayout>
  61. </android.support.constraint.ConstraintLayout>


遇到问题之一:


顶部默认有头部,登录页一般会选择去掉。

在res——values——styles.xml 加一句代码即可

  1. <item name="windowNoTitle">true</item>


遇到问题之二:


修改手机顶部状态栏颜色

在res——values——styles.xml 加一句代码即可

  1. <item name="colorPrimaryDark">#4477e7</item>


遇到问题之三:


背景图片设置!!

在LinearLayout下加上一句代码

  1. android:background="@drawable/dengl_bg"

背景图片即可应用


遇到问题之四:


button填充样式

在右边属性界面  button——style——Widget.AppCompat.Button.Colored 即可如图填充


其他自己设计就好,下一篇首页界面设计


欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739

评价

剑轩

2019/2/23 12:04:05

帅帅帅帅帅!那个背景图是不是有点太大了哦。哈哈相素太高了么,可以拖小一点哇

真正的顺其自然,其实是竭尽所能之后的不强求,而非两手一摊的不作为
排名
19
文章
24
粉丝
11
评论
15
css实现简单矩形对话框
剑轩 : 现在来看一下,这个正好用到
三分钟快速复习MVC知识
瑾语 : 棒 总结的很好
渣渣学安卓之时间选择器和文本框操作
修心 : 666666横线的方式和我想法完全一样
渣渣学安卓之banner图和首页布局
晓见 : 哇哦,小姐姐这个系列文章写得很好哇,期待更多佳作~
渣渣学安卓之登录摸索及页面效果实现
剑轩 : 帅帅帅帅帅!那个背景图是不是有点太大了哦。哈哈相素太高了么,可...
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术
学而不厌,诲人不倦。