android登录设计
A. android怎样做简单的登录
Android开发工具里面创建新app的时候可以创建一个用于登录的activity界面,可以借鉴一下。
B. android 手机登录界面layout怎么设计
1 我们项目的前提是你已经将基本的运行环境及sdk都已经安装好了,读者可自行网络环境配置相关内容,本文不再赘述。右键点击new-->Mole,Mole相当于新建了一个项目。如图所示 2 选择Android Application,点击next 3 将My Mole 和app改成...
C. Android studio怎么连接本地数据库设计登录界面
我们项目的前提是你已经将基本的运行环境及sdk都已经安装好了,读者可自行网络环境配置相关内容,本文不再赘述。右键点击new-->Mole,Mole相当于新建了一个项目。
选择Android Application,点击next
将My Mole 和app改成自己项目相应的名字,同时选择支持的Android版本
这一步我们选择Blank Activity,自己手动编写登录界面,而不依赖系统内置的Login Activity,一直点击next,最后点击finish就完成了项目的创建
在project下我们可以看到出现了我们刚才创建的login项目
展开res/layout,点击打开activity_main.xml文件,在这个文件里我们将完成登录界面的编写
这是初始的主界面,还没有经过我们编写的界面,Android Studio有一个很强大的预览功能,相当给力,将activity_main.xml的代码替换成如下代码:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:stretchColumns="0,3">
<TableRow>
<TextView />
<TextView
android:text="账 号:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24px"
/>
<EditText
D. 如何使用Android Studio开发用户登录界面
一个登录界面需要有:
登录、注册按钮(Button)
用户名、密码输入框(TextView,EditView)
用户协议连接
忘记密码按钮
想好的有哪些控件后,开始设计界面大概样式,比如这个样子:
安卓登录界面就写完了。
E. android开发登录界面怎么写
如果上图所示,就是简单的登录界面了。andord的布局真的是,真的是,哪个。难以掌握的东西,哈,不过一旦了解深入点,又让人爽的不行,流式布局总是比起windows mobile的绝对布局简单而且容易控制。我是越来越倾向于流式布局的方式了,它的一点好处是适应设备时比较灵巧,wm使用了自适应dpi的方式,哪叫一个复杂啊,切不易于控制。
布局的属性 android:layout_width="fill_parent" ,指示了填充父区域,就是父容器有多大空间,就填充多大空间。android:layout_width="wrap_content",指示了它本身需要多大空间,就像父容器索取多大的空间,怎么说呢,就是它有多胖就占多大空。而哪个fill_parent就是不胖也全占满了。
再说android:layout_weight="0.1",这个weight(重量)是个很有意思的东西。可为一个父容器的 “子控件们”设置这个重量属性,父容器根据这个重量的多少择情分给这些子控件们多大空间。同时这个属性还与子控件 宽高属性的显示(fill_parent 或者wrap_content)模式有关。
代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/images1"
>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_weight="0.9"
android:layout_height="fill_parent">
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/LinearLayout02"
android:layout_weight="0.1"
android:orientation="vertical"
android:layout_height="fill_parent">
<LinearLayout android:id="@+id/LinearLayout03" android:layout_width="wrap_content" android:layout_height="wrap_content"></LinearLayout>
<LinearLayout
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:gravity="center"
android:layout_width="fill_parent"
android:id="@+id/LinearLayout_account"
android:orientation="horizontal"
android:layout_height="wrap_content">
<TextView android:textSize="12pt" android:id="@+id/lblAccount"
android:text="@string/accountName"
android:layout_weight="0.75"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></TextView>
<EditText
android:layout_weight="0.25"
android:layout_width="fill_parent"
android:text="mailto:%22 %20android:id=%22@+id/editBoxAccount" android:layout_height="wrap_content"></EditText>
</LinearLayout>
<LinearLayout
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:gravity="center"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<TextView android:textSize="12pt" android:id="@+id/lblPassword"
android:text="@string/password"
android:layout_weight="0.75"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></TextView>
<EditText
android:layout_weight="0.25"
android:layout_width="fill_parent"
android:password="true"
android:text="mailto:%22 %20android:id=%22@+id/editBoxPassword" android:layout_height="wrap_content"></EditText>
</LinearLayout>
<LinearLayout
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:gravity="center"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<Button android:text="登录"
android:textSize="9pt"
android:id="@+id/btnLogin" android:layout_width="fill_parent"
android:layout_height="wrap_content"></Button>
</LinearLayout>
</LinearLayout>
</LinearLayout>
F. android怎么做动态的登陆界面
设计android的登录界面的方法:
UI实现的代码如下:
1、背景设置图片:
background_login.xml
<?xmlversion="1.0"encoding="utf-8"?>
<shapexmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#FFACDAE5"
android:endColor="#FF72CAE1"
android:angle="45"
/>
</shape>
2、圆角白框
效果图上面的并不是白框,其实框是白色的,只是设置了透明值,也是靠一个xml文件实现的。
background_login_div.xml
<?xmlversion="1.0"encoding="UTF-8"?>
<shapexmlns:android="http://schemas.android.com/apk/res/android">
<solidandroid:color="#55FFFFFF"/>
<!--设置圆角
注意:bottomRightRadius是左下角而不是右下角bottomLeftRadius右下角-->
<cornersandroid:topLeftRadius="10dp"android:topRightRadius="10dp"
android:bottomRightRadius="10dp"android:bottomLeftRadius="10dp"/>
</shape>
3、界面布局:
login.xml
<?xmlversion="1.0"encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
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:id="@+id/login_div"
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:id="@+id/login_user_input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="5dp"
android:text="@string/login_label_username"
style="@style/normalText"/>
<EditText
android:id="@+id/username_edit"
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:id="@+id/login_password_input"
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"
style="@style/normalText"/>
<EditText
android:id="@+id/password_edit"
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:id="@+id/signin_button"
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">
<TextViewandroid:id="@+id/register_link"
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"/>
<ImageViewandroid:id="@+id/miniTwitter_logo"
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"/>
<ImageViewandroid: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>
4、java源代码,Java源文件比较简单,只是实例化Activity,去掉标题栏。
packagecom.mytwitter.acitivity;
importandroid.app.Activity;
importandroid.os.Bundle;
importandroid.view.Window;
{
@Override
publicvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.login);
}
}
5、实现效果如下:
G. 如何使用android studio开发用户登录界面
使用AndroidStudio开发用户登录界面是可以直接创建的,创建步骤如下。1、点击菜单栏的“File”-->"New"-->“NewProject”。2、然后输入创建的项目名-->点击"next",。3、然后点击"Next",选择创建登录界面。4.然后点击"Fisih"5、项目创建完成
H. Android studio相对布局怎么设计一个登陆界面
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#55ffff">
<TextView
android:id="@+id/tv_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:padding="10dp"
android:background="#ffffff"
android:hint="密码"
android:textSize="15sp"
android:textColor="#000000"
android:layout_centerInParent="true"/>
<TextView
android:id="@+id/tv_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#ffffff"
android:padding="10dp"
android:hint="用户名"
android:textSize="15sp"
android:layout_marginBottom="15dp"
android:textColor="#000000"
android:layout_above="@+id/tv_password"/>
<TextView
android:id="@+id/tv_forget_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_password"
android:layout_alignLeft="@+id/tv_password"
android:paddingTop="10dp"
android:text="忘记密码>"
android:textSize="14sp"
android:textColor="#ff0000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_password"
android:layout_alignRight="@+id/tv_password"
android:paddingTop="10dp"
android:text="注册>"
android:textSize="14sp"
android:textColor="#ff0000" />
<Button
android:id="@+id/but_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginTop="20dp"
android:background="#4169E1"
android:text="登录"
android:textSize="18sp"
android:textColor="#ffffff"
android:layout_below="@+id/tv_forget_password"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/ic_launcher"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:layout_above="@+id/tv_user"/>
</RelativeLayout>
I. App登录界面----布局篇
我自学了3个月的Android基础,居然一个App都做不出来。在我之前学的同时居然忘记了之前学的内容。所以我现在重新开始复习,这篇文章将是我复习的开始也是基础的稳固,同时也是将来记不得了可以自我回顾的笔记。首先是从App登录开始。
首先第一是布局,登录界面布局那就要用到控件,登录界面所需控件如下:
1.姓名 输入框 密码 输入框:就要有Textview文本控件 X 2, Editview输入文本框控件 X 2
2.立即注册 忘记密码 登录 :就要有Button控件 X 3
既然要布局就要有布局控件:可以用RelativeLayout相对布局,LinearLayout线性布局,TableLayout表格布局,FrameLayout帧布局,AbsoluteLayout绝对布局。我要选用就就是前两个布局:RelativeLayout相对布局或者LinearLayout线性布局。
这就是我最终预想所要达到的效果:
首先打开布局文件:展开app--->res--->layout--->activity_main.xml
切换到设计模式Design:
然后从调色板Palette就是控件库拖拽出所需控件:
2个Textview,2个Editview ,3个Button.一开始布局控件就是相对布局控件,RelativeLayout相对布局控件允许通过指定显示对象相对于父容器或其他兄弟控件的相对位置结合margin,padding来进行布局。
然后我们再切换回文本模式Text:
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>这就组成了一个控件。
再来解释解释RelativeLayout相对布局控件是啥意思:
上图所表现的意思就是RelativeLayout相对布局控件的特点:TextView文本控件基于父容器(RelativeLayout相对布局控件)之下,再看图:
它会自动添加默认属性:android:text="文本控件"//这是文本属性可以输入文字
android:textSize="50dp"//这是文本大小属性是控制text属性的大小
android:layout_width="wrap_content"//这是宽,选择的自适应屏幕
android:layout_height="wrap_content"这是高。
android:layout_marginTop="253dp"// 重点就在这里了:在RelativeLayout相对布局下拖出的控件会有这条属性,意思是TextView相距父容器253dp的距离
android:id="@+id/textView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
好了我们继续:我写的这个布局呢?只用了两个EditView控件和三个Button控件。先说EditView控件。
拖拽出来改好了各种属性但是和我的不一样,哪里不一样?有边框,边框还是圆角。怎么弄的?这是改变了它的样式。首先目录找到drawable文件按下Alt+lns键,点击Drawable resource file
那就会弹出下面这个框框好创建资源文件,File name:这是资源文件的名字,Root element:这是需要创建什么类型的资源文件。
假如没有出现这个对话框而是另外的对话框就请更换模式
将Android 目录模式切换成Project目录模式
找到drawable文件重复上面操作就会出现
名字就自己取吧,类型选择shape文件
这就是我为EditView设置的资源文件,那么怎么加载它呢?
用背景background属性来加载:@drawable/border用@选择文件位置加载就成功了。
文本框就做好了。噢!!!等等还有个属性android:hint="登录"还没介绍,这是提示语:比如请输入用户名,请输入密码,这样的提示语,只起到提示作用。范例:android:hint="请输入用户名"
好吧依次类推,Button按钮也是这样。我们先来看忘记密码,立即注册两控件这两我没这样加载资源文件,我只用了3条属性,
android:background="@null"//这条意思是背景设置路径为空,作用是消除边框。
android:shadowColor="#338AFF"//改变按钮背景颜色,让它看起来和相对布局背景融为一体。
android:textColor="#0066CC"//改变文字颜色
怎么样是不是和QQ登录界面的差不多
那再来看立即登录按钮,这个按钮我用了三个资源文件,为了让按钮按下抬起有一个变色效果,能够反馈用户视觉:您已按下按钮。
首先看按下的资源文件:
这是按下的模样,radius是设置圆角,然后是按下后的颜色。
再来看抬起:
这是抬起时候的样子,圆角按下抬起都要设置一样,不然按下是一个样,抬起又是另一个样子,然后是抬起的颜色。
这是两个资源文件,如何让按钮呈现出按下抬起的不同效果呢?
就需要另一个资源文件来操控:selector资源文件
由他来控制这两个资源文件:
<item/>这是资源文件的标签,包括shape资源文件的:<corners/><solid/>都是标签
标签<item/>里面
android:drawable="@drawable/clickroundedcolor"//是加载按下资源文件,
android:state_pressed="true"//true就是对,就是一个判断作用,判断是否按下,按下就加载按下的资源文件
然后再一个子标签<item/>
<item android:drawable="@drawable/roundedcolor"/>也就是说当上面pressed不为true的时候执行下面这个标签加载抬起状态的效果。
这就做成了按下深蓝抬起浅蓝的颜色效果。那今天就到这里,复习到了什么Editview Button控件的使用然后在原来的基础上学到了EditView 和Button控件的UI设计一些细节效果。
还熟悉了Android studio。之前用Eclipse学习的Android,现在改用AS还特别不习惯,希望复习后我会熟练Android studio。恩,还有看到忘记密码,立即注册两个按钮是不是还会联想到还有两个布局。没错,忘记密码和立即注册这两个布局文件,就不用记录了,相信会了登录主界面布局,其他两个不在话下。
J. 如何用android制作用户登录程序
方法/步骤
我们项目的前提是你已经将基本的运行环境及sdk都已经安装好了,读者可自行网络环境配置相关内容,本文不再赘述。右键点击new-->Mole,Mole相当于新建了一个项目。如图所示
选择Android Application,点击next
将My Mole 和app改成自己项目相应的名字,同时选择支持的Android版本
这一步我们选择Blank Activity,自己手动编写登录界面,而不依赖系统内置的Login Activity,一直点击next,最后点击finish就完成了项目的创建
在project下我们可以看到出现了我们刚才创建的login项目
展开res/layout,点击打开activity_main.xml文件,在这个文件里我们将完成登录界面的编写
这是初始的主界面,还没有经过我们编写的界面,Android Studio有一个很强大的预览功能,相当给力
我们将activity_main.xml的代码替换成如下代码:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:stretchColumns="0,3">
<TableRow>
<TextView />
<TextView
android:text="账 号:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24px"
/>
<EditText
android:id="@+id/account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24px"
android:minWidth="220px"/>
<TextView />
</TableRow>
<TableRow android:layout_marginTop="20px">
<TextView />
<TextView
android:text="密 码:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/pwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="220px"
android:textSize="24px"
android:inputType="textPassword"/>
<TextView />
</TableRow>
<TableRow android:layout_marginTop="20px">
<TextView />
<Button
android:id="@+id/login"
android:text="登录"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/quit"
android:text="退出"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView />
</TableRow>
</TableLayout>
使用Android 手机进行测试,大功告成
注意事项
一定要先配置好java运行环境及android运行环境
跟着步骤操作