导航:首页 > 编程语言 > android欢迎界面代码

android欢迎界面代码

发布时间:2024-04-11 20:02:20

⑴ 如何设计android的登录界面

在网上在到一个登录界面感觉挺不错的,给大家分享一下~先看效果图:

这个Demo除了按钮、小猫和Logo是图片素材之外,其余的UI都是通过代码实现的。

?

一、背景

背景蓝色渐变,是通过一个xml文件来设置的。代码如下:

background_login.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:andro>
<gradient
android:startColor="#FFACDAE5"
android:endColor="#FF72CAE1"
android:angle="45"
/>
</shape>


startColor是渐变开始的颜色值,endColor是渐变结束的颜色值,angle是渐变的角度。其中#FFACDAE5中,FF是Alpha值,AC是RGB的R值,DA是RGB的G值,E5是RGB的B值,每个值在00~FF取值,即透明度、红、绿、蓝有0~255的分值,像要设置具体的颜色,可以在PS上的取色器上查看设置。

?

?

二、圆角白框

效果图上面的并不是白框,其实框是白色的,只是设置了透明值,也是靠一个xml文件实现的。

background_login_div.xml

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:andro>
<solid android:color="#55FFFFFF" />
<!-- 设置圆角
注意: bottomRightRadius是左下角而不是右下角 bottomLeftRadius右下角-->
<corners android:topLeftRadius="10dp" android:topRightRadius="10dp"
android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp"/>
</shape>

?

三、界面的布局

界面的布局挺简单的,就直接贴代码啦~

login.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:andro
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background_login">
<!-- padding 内边距 layout_margin 外边距
android:layout_alignParentTop 布局的位置是否处于顶部 -->

<RelativeLayout
android:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="15dip"
android:layout_margin="15dip"
android:background="@drawable/background_login_div_bg" >
<!-- 账号 -->
<TextView
android:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="5dp"
android:text="@string/login_label_username"
/>
<EditText
android:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/login_username_hint"
android:layout_below="@id/login_user_input"
android:singleLine="true"
android:inputType="text"/>
<!-- 密码 text -->
<TextView
android:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/username_edit"
android:layout_marginTop="3dp"
android:text="@string/login_label_password"
/>
<EditText
android:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/login_password_input"
android:password="true"
android:singleLine="true"
android:inputType="textPassword" />
<!-- 登录button -->
<Button
android:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/password_edit"
android:layout_alignRight="@id/password_edit"
android:text="@string/login_label_signin"
android:background="@drawable/blue_button" />
</RelativeLayout>

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView android:
android:text="@string/login_register_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:textColor="#888"
android:textColorLink="#FF0066CC" />
<ImageView android:
android:src="@drawable/cat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="25dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="25dp" />
<ImageView android:src="@drawable/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/miniTwitter_logo"
android:layout_alignBottom="@id/miniTwitter_logo"
android:paddingBottom="8dp"/>
</RelativeLayout>
</LinearLayout>

⑵ 如何调用微信界面 Android开发

Android欢迎界面有如下几个特点:
第一次打开微信时, 会弹出欢迎界内面(欢迎界面+延迟加载微信主容界面), 之后在打开则不会有该界面弹出
强杀进程 或者 清除最近运行列表, 下次运行时, 则又会弹出欢迎界面
目测上述实现效果, 个人推测可能的实现方法是:
有可能利用了Task & Back Stack 的特性
有可能欢迎界面只是一个单纯的View

⑶ 如何使用Android Studio开发用户登录界面

一个登录界面需要有:

  1. 登录、注册按钮(Button)

  2. 用户名、密码输入框(TextView,EditView)

  3. 用户协议连接

  4. 忘记密码按钮


想好的有哪些控件后,开始设计界面大概样式,比如这个样子:

安卓登录界面就写完了。

阅读全文

与android欢迎界面代码相关的资料

热点内容
为什么电脑微信文件发送不出去 浏览:573
新入职女社员女演员叫什么 浏览:700
可搜索 网站 在线观看 浏览:816
对数据真实性负有什么权 浏览:604
elonafix版本错误 浏览:70
百度网络推广的形式 浏览:691
word左边显示提纲 浏览:810
台湾最好看的三极武工片 浏览:98
2021最新电影免费观看的网址 浏览:629
韩国推理片在线播放 浏览:110
推荐韩日推理电影 浏览:989
华师大电影院 浏览:971
重生汉灵帝刘宏的小说 浏览:512
kktv怎么调到网络电视 浏览:341
数据评价的方法有哪些 浏览:399
日韩好看电影 浏览:170
什么怪谈电影恐怖片 浏览:787
哪些渠道可以查看行业数据 浏览:88
无需下载免费在线观看电影 浏览:230
真实里的马尾女叫什么名字 浏览:548

友情链接