导航:首页 > 操作系统 > android登陆界面

android登陆界面

发布时间:2022-01-13 07:30:04

㈠ 如何设计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 怎样实现登录界面的跳转 详细

intent跳转有两种方式,一种是我们常用的显示跳转,还有一种是隐式跳转。
显式方式:Intent aIntent = new Intent(this,XXActivity.class);第一个是你当前Activity的对象,第一个参数是你要跳转Activity的类。这种方式适合在同一个APP中的内部跳转。
隐式方式:Intent aIntent = new Intent("actiionXXXXXXX"),参数为你在AndroidManifest.xml中配置的Actitiy中<intent-filter><action android:name="actionXXXXXXXX"/><intent-filter>

㈢ android项目未登陆的时候进入登陆界面 登陆的话下一次进来就直接跳到主界面怎么实现

用SharedPreferences来保存当前用户的信息和登录成功的状态

前者是保证你后续的界面能正常调用数据。
后者是判断此用户是否已经登录过一次。

注:保存当前用户的信息一般保存ID

㈣ 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、实现效果如下:

㈤ 如何实现android程序第一次登陆时显示初始界面

SharedPreferences存储一个boolean值,在onCreate()方法中判断这个boolean值,如果为true就显示初始化界面,显示初始化界面之后将存储到SharedPreferences的boolean值设置为false,这样在下次进入到这个activity的时候,由于将boolean值置为false了,就不会初始化那个界面了。

㈥ 怎么用android写一个登入界面

在res文件夹下的zdlayout文件夹下创建文件为“文件名.xml”
然后编写代码或直接专拖动需要的控件到界面上
在启动Activity的onCreate方法中写一句代码“setContentView(R.layout.文件名);”,如果已存在则属替换之

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

右键点击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有一个很强大的预览功能,相当给力,接下来编写代码。

㈧ android登录界面设计输入框用什么控件

这个是EditText,用2个控件 属性里面加 android:hint="用户名" ,分割线的效果 我想是背景图片造成的

㈨ 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&nbsp;%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&nbsp;%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>

㈩ 急求用eclipse做的android application!!(登录界面的(login))

http://www.eoeandroid.com/thread-225709-1-1.html
你看看这个把,认真看一下。照着自己写写,对你有帮助!如果不懂在回复我!希望能够帮助你

阅读全文

与android登陆界面相关的资料

热点内容
服务器一直崩应该用什么指令 浏览:916
cm202贴片机编程 浏览:724
php构造函数带参数 浏览:175
解压电波歌曲大全 浏览:336
为啥文件夹移到桌面成word了 浏览:858
命令符的安全模式是哪个键 浏览:758
编程中学 浏览:956
单片机求助 浏览:993
ug加工侧面排铣毛坯怎么编程 浏览:271
程序员有关的介绍 浏览:736
支付宝使用的什么服务器 浏览:210
安卓看本地书用什么软件好 浏览:921
经传软件滚动净利润指标源码 浏览:522
萤石云视频已加密怎么解除 浏览:574
一命令四要求五建议 浏览:30
qq文件夹迁移不了 浏览:19
液体粘滞系数测定不确定度算法 浏览:332
轻栈源码 浏览:426
把图片压缩到500k 浏览:35
命令你自己 浏览:369