Android实现简单QQ登录页面

Android开发实现极为简单的QQ登录页面,供大家参考,具体内容如下

设计一个简单QQ登录页面,无任何功能。然后打包安装到手机。

1.首先创建一个空白页面

2.打开样式设计的页面

在activity_main.xml中写入代码

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#E6E6E6"//改背景色
    tools:context=".MainActivity">
    <RelativeLayout android:layout_width="match_parent"//相对布局
        android:layout_height="match_parent"
        android:layout_marginTop="60dp"//距顶部距离
        android:background="#E6E6E6"//改背景色
        android:orientation="vertical">

    <ImageView//放图片
        android:id="@+id/iv"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_centerHorizontal="true"//居中
        android:layout_marginTop="40dp"
        android:background="@drawable/head"/>//图片的位置

    <LinearLayout//线性布局
        android:id="@+id/ll_number"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/iv"//在imageview下面
        android:layout_centerVertical="true"//居中
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="15dp"
        android:background="#ffffff">
        <TextView//显示文本
            android:id="@+id/tv_number"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="10dp"
            android:text="账号:"
            android:textColor="#000"
            android:textSize="20sp"/>
        <EditText//输入框
            android:id="@+id/et_number"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:background="@null"
            android:padding="10dp"/>
    </LinearLayout>
    <LinearLayout
        android:id="@+id/ll_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/ll_number"
        android:layout_centerVertical="true"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:background="#ffffff">
        <TextView
            android:id="@+id/tv_password"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="10dp"
            android:text="密码:"
            android:textColor="#000"
            android:textSize="20sp"/>
        <EditText
            android:id="@+id/et_password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_toRightOf="@id/tv_password"
            android:background="@null"
            android:inputType="textPassword"//密文显示
            android:padding="10dp"/>
    </LinearLayout>
    <Button//登录按钮
        android:id="@+id/btn_login"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/ll_password"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="50dp"
        android:background="#3C8DC4"
        android:text="登录"
        android:textColor="#ffffff"
        android:textSize="20sp"/>
    </RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

在虚拟机里跑一下

效果还算可以吧
试试能不能打包一下,安装到手机上。

报错了…

网上查了一下解决办法。在build.gradle文件里添点代码:

lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

成功了。

挺不错

参考图书《Android移动开发基础案例教程》

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。

(0)

相关推荐

  • Android使用友盟集成QQ、微信、微博等第三方分享与登录方法详解

    最近项目需要加入第三方分享和登录功能,之前其他项目的第三方分享和登录一直都使用ShareSDK实现的.为了统一使用友盟的全家桶,所以三方分享和登录也就选择了友盟.这里记录一下完整的集成与使用流程. 1.申请友盟Appkey 直接到友盟官网申请即可 2.下载SDK 下载地址:http://dev.umeng.com/social/android/sdk-download 下载的时候根据自己需求进行选择,我这里选择选择的是精简版(包含常用的分享与登录功能),只测试微信,QQ,新浪微博. 下载后解压出

  • Android第三方登录之QQ登录

    本文实例为大家分享了Android第三方登录之QQ的具体代码,供大家参考,具体内容如下 第三方登录之QQ 代码区 public class MainActivity extends AppCompatActivity { private Button btn; private TextView tv; private ImageView image; @Override protected void onCreate(Bundle savedInstanceState) { super.onCr

  • Android Studio实现第三方QQ登录操作代码

    来看看效果图吧     http://wiki.open.qq.com/wiki/mobile/SDK%E4%B8%8B%E8%BD%BD 下载SDKJar包 接下来就可以 实现QQ登录了, 新建一个项目工程 ,然后把我们刚才下载的SDK解压将jar文件夹中的jar包拷贝到我们的项目libs中 导入一个下面架包就可以 项目结构如下 打开我们的清单文件Androidmanifest 在里面加入权限和注册Activity 如下 <?xml version="1.0" encoding

  • Android QQ登录界面绘制代码

    先看看效果图: 首先过程中碰到的几个问题: 1.对 EditText 进行自定义背景 2.运行时自动 EditText 自动获得焦点 3.在获得焦点时即清空 hint ,而不是输入后清空 4.清空按钮的出现时机(在得到焦点并且有输入内容时) ---  这些问题都有一一解决 --- 以下是代码: 布局 fragment_main(问题2) <!-- android:focusable="true" android:focusableInTouchMode="true&qu

  • Android调用第三方QQ登录代码分享

    本文为大家分享了调用QQ登录的相关代码,希望对大家有帮助,减少项目开发的时间,具体内容如下 1.去QQ开放平台注册帐号(http://open.qq.com/),为应用申请QQ的APP_ID , 并下载相关的jar包,放到工程的lib目录下. 2.在Manifest.xml里注册QQ相关的Activity,代码如下 <activity android:name="com.tencent.connect.common.AssistActivity" android:screenOr

  • Android仿QQ在状态栏显示登录状态效果

    运行本实例,将显示一个用户登录界面,输入用户名(hpuacm)和密码(1111)后,单击"登录"按钮,将弹出如下图所示的选择登录状态的列表对话框, 单击代表登录状态的列表项,该对话框消失,并在屏幕的左上角显示代表登录状态的通知(如图) 过一段时间后该通知消失,同时在状态栏上显示代表该登录状态的图标(如图) 将状态栏下拉可以看到状态的详细信息(如图) 单击"更改登录状态"按钮,将显示通知列表.单击"退出"按钮,可以删除该通知. 具体实现方法: 此处

  • Android实现QQ登录功能

    QQ登录是一个非常简单的一个第三方应用,现在,我们就来实现一个QQ登录 首先下载两个jar包   这里上传不了jar包,所以可以到我的github中下载工程中libs中的两个jar包 网址:https://github.com/chengzexiang/qqlogin 打代码前,先把这些东西写上: private static final String TAG = "MainActivity"; private static final String APP_ID = "11

  • Android Studio实现简单的QQ登录界面的示例代码

    一.项目概述 QQ是我们日常生活使用最多的软件之一,包含登录界面和进入后的聊天界面.好友列表界面和空间动态界面等.登录界面的制作比较简单,主要考验布局的使用,是实现QQ项目的第一步.现在APP开发的首要工作都是实现登录页面,所以学会了QQ登录界面对以后的软件开发有着很重要的作用. 二.开发环境 三.详细设计 1.头像设计 首先在layout文件里面选择了RelativeLayout(相对布局)作为整个页面的布局. 在顶端放置了一个ImageView控件,宽度和高度设置的都是70dp,水平居中设置

  • Android第三方登录之腾讯QQ登录的实例代码

    布局文件 <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="登录成功" android:textSize="25sp" android:layout_marginTop="100dp" /> 清单文件中的配置 <activity android:n

  • Android实现QQ登录界面遇到问题及解决方法

    先给大家炫下效果图: 首先过程中碰到的几个问题: 1.对 EditText 进行自定义背景 2.运行时自动 EditText 自动获得焦点 3.在获得焦点时即清空 hint ,而不是输入后清空 4.清空按钮的出现时机(在得到焦点并且有输入内容时) ......... --- 这些问题都有一一解决 --- 以下是代码: 布局 fragment_main(问题2) <!-- android:focusable="true" android:focusableInTouchMode=&

随机推荐