ReactNative——UI1.登录界面样式设置
使用React 基本组件结合flex 属性,实现简单登录布局UI 效果
效果预览:
项目结构:
loginView.js 文件:
/**
* Created by admin on 2017-8-8.
* 登录界面UI
*/
'use strict'
import React, {Component} from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
TextInput, TouchableOpacity,
} from 'react-native';
const portraitUrl = require('./img/icon_after_loading.png');
const sinaUrl = require('./img/sina_blog.png');
const qqUrl = require('./img/tencent_qq.png');
const wxUrl = require('./img/tencent_wechat.png');
let Dimensions= require('Dimensions');
let{width,height,scale}=Dimensions.get('window');
export default class LoginView extends Component {
render(){
return(
<View style={styles.container}>
{/*头像*/}
<Image source={portraitUrl} style={styles.style_image}/>
{/*输入框*/}
<TextInput
autoFocus={true}
placeholder={'请输入用户名'}
underlineColorAndroid={'transparent'}
style={styles.style_textInput}/>
<View style={{height: 1, backgroundColor: '#f4f4f4'}}/>
<TextInput
placeholder={'请输入密码'}
secureTextEntry={true}
underlineColorAndroid={'transparent'}
style={styles.style_textInput_pwd} />
<TouchableOpacity activeOpacity={0.5}>
<View style={styles.style_text_login}>
<Text style={{color:'white'}}>登录</Text>
</View>
</TouchableOpacity>
{/*无法登录&新用户*/}
<View style={styles.style_setting}>
<TouchableOpacity activeOpacity={0.5}>
<Text style={styles.style_view_unlogin} >无法登录?</Text>
</TouchableOpacity>
<TouchableOpacity activeOpacity={0.5}>
<Text style={styles.style_view_register}>新用户</Text>
</TouchableOpacity>
</View>
{/*其他登录方式*/}
<View style={styles.style_other}>
<Text style={styles.style_view_unlogin} >其他登录方式:</Text>
<TouchableOpacity activeOpacity={0.5}>
<Image source={sinaUrl} style={styles.style_image_other}/>
</TouchableOpacity>
<TouchableOpacity activeOpacity={0.5}>
<Image source={qqUrl} style={styles.style_image_other}/>
</TouchableOpacity>
<TouchableOpacity activeOpacity={0.5}>
<Image source={wxUrl} style={styles.style_image_other}/>
</TouchableOpacity>
</View>
</View>
)
};
}
const styles = StyleSheet.create({
container:{
flex:1,
},
style_image:{
marginTop:100,
height:80,
width:80,
alignSelf:'center',
},
style_textInput:{
height:38,
backgroundColor:'#fff',
marginTop:50,
textAlign:'center',
},
style_textInput_pwd:{
height:38,
backgroundColor:'#fff',
textAlign:'center',
},
style_text_login:{
width:0.95*width,
backgroundColor:'#63B8FF',
marginTop: 40,
height:45,
borderRadius: 5,
justifyContent: 'center',
alignItems: 'center',
alignSelf:'center'
},
style_setting:{
//设置主轴方向
flexDirection:'row',
//主轴对齐方式
justifyContent:'space-between',
paddingTop:20,
},
style_view_unlogin: {
fontSize: 12,
color: '#63B8FF',
marginLeft: 10,
},
style_view_register: {
fontSize: 12,
color: '#63B8FF',
marginRight: 10,
},
style_other:{
bottom:20,
//绝对定位
position:'absolute',
//主轴的方向
flexDirection:'row',
marginTop:50,
//侧轴对齐方式
alignItems:'center'
},
style_image_other:{
height:40,
width:40,
margin:10,
},
});
index.android.js:
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import LoginView from './loginView';
export default class Day0808 extends Component {
render() {
return (
<LoginView/>
);
}
}
AppRegistry.registerComponent('Day0808', () => Day0808);
不论大神还是新手,欢迎加QQ群一起讨论问题学习技术:230274309
ReactNative——UI1.登录界面样式设置的更多相关文章
- webform登陆界面样式丢失
本文摘抄自:http://blog.csdn.net/sssix/article/details/16945347 请阅读原文. Forms验证——登录界面样式实效? <authenticati ...
- jQuery和CSS3炫酷GOOGLE样式的用户登录界面
这是一款使用jQuery和CSS3打造的GOOGLE样式的用户登录界面特效.该登录界面特效中,右上角的小问号和错误提示小图标使用SVG来制作.username和password输入框採用浮动标签特效. ...
- CSS样式案例(2)-制作一个简单的登录界面
首先来张完工的效果图. 一.html文件如下: <!DOCTYPE html> <html> <head> <meta charset="UTF-8 ...
- swift项目实战--微博的未登录界面的实现,和监听未登录界面两个按钮的两种实现方法
1.未登录界面的实现 微博项目中,用户不登录的话,显示的是未登录的界面.项目中TabBarVC的子控制器都是tableViewVC,所以抽取了父类,让父类判断用户是否登录,决定显示什么样的界面.loa ...
- iOS开发UI篇—模仿ipad版QQ空间登录界面
iOS开发UI篇—模仿ipad版QQ空间登录界面 一.实现和步骤 1.一般ipad项目在命名的时候可以加一个HD,标明为高清版 2.设置项目的文件结构,分为home和login两个部分 3.登陆界面的 ...
- 萌货猫头鹰登录界面动画iOS实现分析
动画效果仿自国外网站readme.io的登录界面,超萌可爱的猫头鹰,具体效果如下图所示. 动画实现核心: 动画核心的是用到了iOS中UIView的transform属性,然后根据尺寸坐标对四张图片进行 ...
- 基于控制权限和登录验证跳转的django登录界面的实现
django框架提供了出去登录和退出系统的login和logout的视图函数,本实现中使用系统自带的是视图函数.需要在settings.py,urls.py,views.py和模板文件等几个方面进行考 ...
- 仿知乎app登录界面(Material Design设计框架拿来就用的TexnInputLayout)
在我脑子里还没有Material Design这种概念,就我个人而言,PC端应用扁平化设计必须成为首选,手当其冲的两款即时通讯旺旺和QQ早就完成UI扁平化的更新,然而客户端扁平化的设计本身就存在天生的 ...
- 使用Axure RP原型设计实践03,制作一个登录界面的原型
本篇体验做一个登录界面的原型. 登录页 首先在Page Style里为页面设置背景色. 如果想在页面中加图片,就把Image部件拖入页面,并设置x和y轴.双击页面中的Image部件可以导入图片.在Im ...
随机推荐
- UVa 10603 倒水问题
https://vjudge.net/problem/UVA-10603 题意:三个杯子,倒水问题.找出最少倒水量. 思路:路径寻找问题.不难,暴力枚举. #include<iostream&g ...
- ros python 订阅robot_pose
#!/usr/bin/env python import rospy import tf import time from tf.transformations import * from std_m ...
- ubuntu server 多网卡
https://wenku.baidu.com/view/51fb15742f60ddccdb38a007.html
- Ubuntu更新软件源出现GPG error
原因 在sources.list文件中加入了非ubuntu官方源,所以认为加入源是不可信任的. 解决方法导入该源公钥.E084DAB9为PUBKEY后八位 gpg --keyserver keyser ...
- [原][OSG]整理osg渲染一帧的流程
参考:最长的一帧 先看下frame void ViewerBase::frame(double simulationTime) { advance(simulationTime);//记录仿真时间,帧 ...
- Codeforces 735B - Urbanization
735B - Urbanization 思路:贪心.人数少的城市住钱最多的那几个人. 不证明了,举个例子吧:a1<a2<a3<a4<a5 (a1+a2+a3)/3+(a4+a5 ...
- vsftpd配置手册(实用)
作者: 木頭 来源: PHPChina 开源社区门户1.vsftpd配置参数详细整理 #接受匿名用户 anonymous_enable=YES #匿名用户login时不询问口令 no_anon_ ...
- ArcGIS API for Silverlight——小滑块
Widgets翻译过来是小玩具.如果使用过Dojo或者ExtJS等js框架肯定会了解到这个“小玩具”也有大用处,能够在很大程度上减少我们的工作量,快速完成功能需求.能减少多大工作量呢?让我们先来,点击 ...
- 新概念 Lesson 3 Nice to meet you
Nice to meet you. 你好 打招呼: hi,hello 重点: 打招呼和互相介绍.主系表结构 Is Chang-woo Chinese? 昌武是中国人吗? No,he isn't . H ...
- Confluence 6 选项 1 – 在 Confluence 中手动重建用户和用户组
当你只有少量的用户和用户组的时候,使用这个方法. 使用 Confluence 的系统管理员登录 Confluence. 进入用户目录管理界面,然后移动 内部目录(internal directory) ...