android布局技巧之类微信对话输入布局

android 仿微信demo————登录功能实现(移动端) 文章目录移动端登录功能实现测试 移动端登录功能实现 登录功能基本和注册一样,唯一不同的是登录可以实现两种登录方式(微信号和手机号),也就是布局不一样。所以需要两个布局,两个activity(这个方法比较简单粗暴,也可以通过activity动态切换布局,这样只需要一个activity就可以了) 创建两个activity,实现两种登录方式 微信号登录activity Login_User.java package com.example.wxchatdemo; import android.annotatio 阅读详情

在设计的过程中我们一定经常会遇到这样的需求:

一行内放3个控件,左边控件左对齐,右面控件右对齐,中间控件来填充剩下的空间。

或者一列内放3个控件,上面的与顶部对齐,下面的沉在最底部,中间控件是弹性的,充满剩余空间。

情况一:水平布局

图示:


这是第一种情形。由于涉及到ImageView,想保持图片原比例不便使用LinearLayout的weight属性。

解决办法:

1.外层套一个RelativeLayout

2.三个控件分别装进3个LinearLayout中,假如id分别为leftlayout,midlayout,rightlayout

    leftlayout属性:android:layout_width="wrap_content"

    rightlayout属性:android:layout_width="wrap_content"

    midlayout属性: android:layout_width="match_parent"

                                   android:layout_toLeftOf="@+id/rightlayout"
                                   android:layout_toRightOf="@+id/leftlayout" 

这样就可以达到两端控件分别左右对齐,中部控件填充剩余空间的效果。


上图效果的代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="34dp"
    android:background="#FFFFFF"
    android:orientation="horizontal" >
    
      <LinearLayout
    	android:id="@+id/choosetags_listview_item_leftlayout"
    	android:layout_width="wrap_content"
    	android:layout_height="wrap_content"
    	android:layout_alignParentLeft="true">
    
   		 <ImageView
   		     android:id="@+id/taglistview_item_ico"
   		     android:layout_width="30dp"
   		     android:layout_height="30dp"
   		     android:layout_gravity="center_vertical"
   		     android:layout_marginBottom="2dp"
   		     android:layout_marginLeft="5dp"
   		     android:layout_marginRight="5dp"
   		     android:layout_marginTop="2dp"
   		     android:contentDescription="@string/app_name"
   		     android:src="@drawable/tag_ico_movie" />
   		 
		</LinearLayout>

		<LinearLayout
		    android:id="@+id/choosetags_listview_item_midlayout"
		    android:layout_width="match_parent"
		    android:layout_height="fill_parent"
		    android:layout_centerVertical="true"
		    android:layout_toLeftOf="@+id/choosetags_listview_item_rightlayout"
		    android:layout_toRightOf="@+id/choosetags_listview_item_leftlayout" >
    
			<com.coolletter.util.MarqueeTextView
			    android:id="@+id/taglistview_item_name"
			    android:layout_width="fill_parent"
			    android:layout_height="fill_parent"
			    android:layout_gravity="center_vertical"
			    android:checkMark="?android:attr/textCheckMark"
			    android:ellipsize="marquee"
			    android:focusableInTouchMode="true"
			    android:gravity="center_vertical"
			    android:marqueeRepeatLimit="marquee_forever"
			    android:paddingEnd="5dp"
			    android:paddingStart="5dp"
			    android:scrollHorizontally="true"
			    android:singleLine="true"
			    android:textColor="#000000"
			    android:textSize="15dp" />
 
	    </LinearLayout> 
	    	
		<LinearLayout
		    android:id="@+id/choosetags_listview_item_rightlayout"
		    android:layout_width="wrap_content"
		    android:layout_height="wrap_content"
		    android:layout_alignParentRight="true"
		    android:layout_centerVertical="true" >
   		 
		    <TextView
		        android:id="@+id/taglistview_item_newnum"
		        android:layout_width="wrap_content"
		        android:layout_height="wrap_content"
		        android:layout_gravity="center_vertical"
		        android:text="253"
		        android:textColor="#000000" >
	    
			</TextView>   
    		
		</LinearLayout>

	
</RelativeLayout>
    

情形二:垂直布局

图示:

垂直布局方案:

1.外层放一个RealtiveLayout

2.内部三个控件分别装进3个LinearLayout中,id设为topayout,midlayout,bottomlayout

   toplayout属性:android:layout_width="wrap_content"

   bottomlayout属性:android:layout_width="wrap_content"

   midlayout属性: android:layout_width="match_parent"

                                   android:layout_below="@+id/toplayout"
                                   android:layout_above="@+id/bottomlayout" 



布局:

                              

代码:


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#DCDCDC"
    android:orientation="vertical" >
    
    <LinearLayout
    	android:id="@+id/letter_newtext_toplayout"
    	android:layout_width="fill_parent"
    	android:layout_height="45dp"
    	android:layout_alignParentTop="true"
    	android:background="#FFFAF0"
    	android:orientation="horizontal" >
                
    		    <TextView
    		        android:id="@+id/letter_newtext_cancel"
    		        android:layout_width="wrap_content"
    		        android:layout_height="wrap_content"
    		        android:layout_gravity="center_vertical"
    		        android:layout_marginBottom="5dp"
    		        android:layout_marginTop="5dp"
    		        android:layout_weight="1"
    		        android:gravity="center_horizontal"
    		        android:text="Cancel"
    		        android:textColor="#000000"
    		        android:textSize="16dp" />

    			<TextView
    			    android:id="@+id/letter_newtext_submit"
    			    android:layout_width="wrap_content"
    			    android:layout_height="wrap_content"
    			    android:layout_gravity="center_vertical"
    			    android:layout_marginBottom="5dp"
    			    android:layout_marginTop="5dp"
    			    android:layout_weight="1"
    			    android:gravity="center_horizontal"
    			    android:text="Submit"
    			    android:textColor="#000000"
    			    android:textSize="16dp" />
                
    </LinearLayout>
    
      <LinearLayout
          android:id="@+id/letter_newtext_mainlayout"
          android:layout_width="fill_parent"
          android:layout_height="match_parent"
          android:layout_above="@+id/letter_newtext_deliver"
          android:layout_below="@+id/letter_newtext_toplayout"
          android:orientation="vertical"
         >
        	
    		<EditText
    		    android:id="@+id/letter_newtext_content"
    		    android:layout_width="fill_parent"
    		    android:layout_height="fill_parent"
    		    android:layout_marginBottom="5dp"
    		    android:layout_marginLeft="5dp"
    		    android:layout_marginRight="5dp"
    		    android:layout_marginTop="5dp"
    		    android:background="@drawable/corners_bg" 
    		    android:gravity="top"
    		    android:inputType="textMultiLine"
    		    android:textColor="#000000" />

		</LinearLayout>
		
       	<View
       	    android:id="@+id/letter_newtext_deliver"
       	    android:layout_above="@+id/letter_newtext__bottomlayout"
            android:layout_width="fill_parent"
            android:layout_height="0.5dp"
            android:background="#00BFFF" />

		<LinearLayout
		    android:id="@+id/letter_newtext__bottomlayout"
		    android:layout_width="fill_parent"
		    android:layout_height="wrap_content"
		    android:layout_alignParentBottom="true"
		    android:layout_marginBottom="5dp"
		    android:layout_marginTop="5dp"
		    android:gravity="bottom"
		    android:orientation="horizontal" >
        		
                <ImageView
                    android:id="@+id/letter_newtext_ico_tag"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_marginLeft="5dp"
                    android:background="@drawable/letter_new_ico_maintag" />
                
                <TextView
                    android:id="@+id/letter_newtext_tag_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:textColor="#000000"
                    android:textSize="15dp" />
        		
       </LinearLayout>


</RelativeLayout>
当这种情况中间的控件是一个ScrollView时,也使用这种办法。就能实现ScrollView充满上下两个控件中间的区域。

Reference:

http://blog.youkuaiyun.com/geeklei/article/details/38968735



安卓模仿微信聊天界面(一) 因为表情包实现比较麻烦,现在还在做,做完了发,还有就是对话框和微信不一样是因为没有合适的对话框的png图片用来做.9的图片. 依赖 implementation 'androidx.recyclerview:recyclerview:1.0.0' 在drawable里新建几个drawable resource file buttonbackground <?xml vers... 阅读详情

相关推荐

仿微信点击回复,输入框定位到列表的底部

最近设计提了这么一个需求,就是要仿微信的朋友圈,点击回复的时候,输入框要定位到当前item的底部,为了这么一个小小的功能,把姐姐我折腾了三天,真的是用尽了办法,最后发现,其实真的不是很难,功能实现之后,我的第一反应就是要写一篇博客,希望被同样问题困扰的开发的小白能够有些帮助. 需求的功能: 这就是设计想要的效果,就是点击回复的按钮的时候,对话框要定位到这个动态的底部.一开始真的很懵,根本不知道该从

Love_Beauty的博客 5059

【Android开发日记】妙用 RelativeLayout 实现3段式布局

在设计的过程中我们一定经常会遇到这样的需求: 一行内放3个控件,左边控件左对齐,右面控件右对齐,中间控件来填充剩下的空间。 或者一列内放3个控件,上面的与顶部对齐,下面的沉在最底部,中间控件是弹性的,充满剩余空间。 情况一:水平布局 图示: 这是第一种情形。由于涉及到ImageView,想保持图片原比例不便使用LinearLayout的weight属性。 解决办法: 1.

GeekLei 4997

Android仿微信语音聊天demo

其实我接触android时间也不是很久,但是发现android远远比我们想象的要有趣并且复杂很多,所以还是要多花点时间来写一写这些demo例子,这个程序是我从慕课网上学来的,因为毕竟要自己手写,才能体会到程序的完整性,所以我还是建议大家自己手写代码,大部分代码我已经添加了注释,如果有疑问,大家一起来讨论讨论。

u013982769的专栏 3492

android相对布局一行三个,037-布局-相对布局-RelativeLayout

RelativeLayout又称作相对布局,也是一种非常常用的布局。和LinearLayout的排列规则不同,RelativeLayout显得更加随意一些,它可以通过相对定位的方式让控件出现在布局的任何位置。android:layout_width="match_parent"android:layout_height="match_parent">android:id="@+id/butt...

weixin_39857513的博客 332

打造Android仿微信确认对话框的实战教程

在移动应用开发中,与用户交互的界面设计至关重要。其中,确认对话框是用户进行关键操作前的最后一道“闸门”,确保操作的准确性和安全性。随着微信等社交应用的普及,其简洁明了、具有良好用户体验的对话框设计被广泛模仿。本章将介绍Android仿微信确认对话框的基本概念和应用背景,为读者搭建起后续章节内容学习的基础框架。对话框是Android应用中常见的UI组件,用于显示重要信息、提供用户决策选项或者收集用户输入。在Android开发中,标准的对话框组件是。

weixin_42360733的博客 681

Android仿微信对话框弹出动画设计教程

在现代移动应用中,用户界面的自定义布局设计是提升用户体验的关键因素之一。本章节将探讨如何在Android平台下实现自定义布局设计,从基本概念到具体实现步骤,我们将逐层深入,确保即使是5年以上的IT从业者也能从中获得新的见解。为了填充内容,PopupWindow可以使用任何视图组件。通常,我们通过布局文件来创建复杂的视图层级结构。一旦布局文件准备就绪,可以这样将其设置为PopupWindow的内容视图:-- 在这里添加子视图 -->

weixin_29138345的博客 999

ConstraintLayout-进阶的RelativeLayout

近日伴随着Android Studio 2.2的正式推送,最大的亮点是布局的蓝图模式以及与之配套的ConstraintLayout关注度一下子高了起来. ConstraintLayout,翻译过来,可以叫约束布局,其子view就是通过一个个属性的约束,来决定自己的位置,大小,而传统的RelativeLayout也类似,所以可以看成是RelativeLayout的一种进化版版本,属性布局用法相对R

u010897392的专栏 1722

打造微信分享风格的自定义Dialog对话框

Android中,Dialog是常用于展示信息和执行用户操作的弹出窗口。它是轻量级的,不占用太多屏幕空间,同时也不需要像Activity一样占用单独的堆栈。Dialog可以在任何地方显示,通常用于显示警告信息、输入数据和选择选项。在Android开发中,Dialog可以分为三种类型:AlertDialog、ProgressDialog和自定义Dialog。AlertDialog用于显示信息、列表选择或输入数据。ProgressDialog用于显示正在进行的操作。

weixin_30476025的博客 913

Android 笔记之动态创建button 一行三列

package com.example.mytest2; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.DisplayMetrics; import android.view.Menu; import android.vi

yungcs的专栏 2235

Android平台上的微信功能模拟Demo

Android应用开发是移动开发领域的热门话题,它为开发者提供了构建多样、响应迅速、用户友好的移动应用的强大平台。本章将从Android开发的基础知识入手,向读者介绍如何入门Android应用开发,概述这个过程涉及的主要概念和技术。用户在设置菜单中进行的更改需要被保存下来,并在应用运行时被读取。这通常是通过 SharedPreferences 实现的,它提供了一个简单的机制来存储和检索键值对。// 获取SharedPreferences实例// 存储数据// 读取数据。

weixin_28487725的博客 630

深度解析Android微信客户端源码:架构、设计与实战

在当今高度互联的数字世界,微信已经成为人们日常通信不可或缺的一部分。对于Android开发人员来说,深入研究微信客户端的源码不仅可以帮助我们理解大型应用程序的设计和实现原理,还能启发我们提高自身的编程技能。本章节将简要介绍微信Android客户端源码的基本结构和关键组件,为进一步探讨其内部细节奠定基础。微信客户端的源码,可从以下几个方面进行概述:SSL(安全套接层)和TLS(传输层安全性协议)是网络通信中用于保证数据传输安全的协议。

weixin_35794316的博客 950

Android之ListView(三)

文章目录activity_main.xmlchatting_item_msg_text_left.xmlchatting_item_msg_text_right.xmlChatActivity 目标图: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android=...

qq_39438055的博客 293

PP触发EWM产生PMR捡配

PP触发EWM产生PMR捡配 前言 PMR: Production Material Request 在流程订单/生产订单下达后,可以在EWM中产生PMR,在EWM中, PMR其实代表了ERP中的流程订单/生产订单。 You can use SAP EWM in conjunction with the following PP application components: • Production Orders • Process Orders • Repetitive Manufacturing •

ZevYang的博客 1918

android微信风格,Android开发实现模仿微信小窗口功能【Dialog对话框风格窗口】

本文实例讲述了Android开发实现模仿微信小窗口功能。分享给大家供大家参考,具体如下:运用方法:将显示窗口的风格 设置为对话框风格即可具体效果:具体实现:首先我们先定义布局文件:android:id="@+id/idtatabHost"android:layout_width="300dp"android:layout_height="500dp"android:layout_gravity="...

weixin_31572175的博客 179

MaxEnt软件的下载与安装

1、下载网站:http://lucky-boy.ys168.com/ (这是之前在网上搜到的,里面有许多软件安装包,感谢网页主的资源共享,违权必删)

weixin_42191203的博客 2万+

GE Proficy Historian8.0历史数据库部署与配置全攻略

本文提供了GE Proficy Historian 8.0历史数据库的详细部署与配置指南。内容涵盖安装前的系统环境、权限与依赖检查,服务器安装的关键步骤与类型选择,采集器的安装配置与数据接入,以及客户端工具的使用与数据分析实战。旨在帮助用户规避常见陷阱,实现一次部署成功,构建稳定高效的工业数据归档平台。

silver的专栏 766

Android 仿微信点赞和评论弹出框

本文简单模仿微信朋友圈的点赞和评论弹出框,布局等细节请忽略,着重实现弹出框、发评论,及弹出位置的控制。

关注移动端、Web、微信小程序等大前端领域 5万+

基于高精度三维机器视觉的新能源汽车锂电池表面缺陷检测

在机器视觉行业迅速发展的背景下,市场上提供了功能强大且种类齐全的3D相机系列,可以满足锂电池从电芯到模组各个工艺和工位的3D检测需求。

Hinyeung_Limited的博客 1132

Android Studio 制作微信,登入界面,输入密码界面,跳转手机登录界面,以及聊天界面

2.打开Android Studio。3.选择 "Create New Project"。4.在 "Create New Project" 对话框中,输入项目名称、选择存储位置等信息。5.选择最低支持的Android版本,并选择一个适合的活动模板(例如,Empty Activity)。6.点击 "Finish" 创建新的Android项目。

2301_78500577的博客 3328

Oracle Linux中/var/log/pcp/pmlogger目录膨胀问题分析与解决

本文详细分析了Oracle Linux系统中/var/log/pcp/pmlogger目录异常膨胀的常见原因与解决方案。当PCP性能监控框架的pmlogger服务日志轮转或清理机制失效时,会导致该目录无限增长,威胁系统稳定。文章提供了从服务状态诊断、配置文件审查到安全清理与预防策略的全流程实战指南,帮助运维人员快速回收磁盘空间并恢复服务正常运行。

weixin_29208327的博客 371

2024年游戏策划最新面试题及答案

1. **游戏策划**:负责游戏设计和开发的创意和技术过程。2. **主要职责**:设计游戏玩法、故事、角色、世界等。4. **游戏机制**:定义玩家如何与游戏世界互动的规则。13. **引人入胜的角色**:深入的背景故事、个性特征。3. **游戏平衡**:确保游戏公平、有趣且具有挑战性。7. **RPG特点**:角色发展、故事驱动、玩家选择。12. **关卡设计技巧**:挑战性、流动性、视觉引导。11. **游戏关卡设计**:创建游戏世界的不同阶段。5. **游戏循环**:玩家在游戏中重复的行为模式。

guo162308的博客 2320

Android 高仿微信对话框

通用自定义dialog,高仿微信对话框

qq_17769455的博客 257

一步一步详解LSTM网络【从RNN到LSTM到GRU等,直至attention】

本文主要译至并加上了部分笔者的见解,对于全面理解LSTM有一定的帮助。

zik的博客 3078

wechat-dump实战指南:3分钟快速导出微信聊天记录为HTML

微信聊天记录包含了我们重要的沟通回忆和珍贵信息,但微信官方并没有提供方便的导出功能。wechat-dump是一款免费、开源的强力工具,专门用于从Android设备分析和导出微信聊天记录,并将其转换为易读的HTML格式,让你能够轻松备份、查看和分析所有聊天内容。 ## 🎯 项目概述:你的微信聊天记录备份专家 wechat-dump是一个专为Android微信用户设计的聊天记录导出工具,它能够:

gitblog_01070的博客 390

【网络安全】浅谈数据库攻击复现及相关安全优化

4、准备数据库服务器为了安全正式环境应该把数据库单独放一台服务器,只允许让应用服务器 IP 来访问数据库服务器,通过独立两者,就算其中一台发生问题,另一台也是好的,进一步降低了危险性。5、定时备份数据库开发定时备份功能,可以使用 Crontab,或者其他框架,设定周期备份数据,哪怕是数据丢失或被删除也可以快速恢复。

2401_88545587的博客 221

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Android kotlin 实现仿微信快手点击列表item后弹出输入框,所item自动滚动到输入框上方功能

RecyclerView+BRVAH3.0.6+androidx+AnyLayer+EditText

彬sir哥的博客 1409

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

上一篇: Android开发大牛博客
下一篇: 将Activity加入到Application中的List中的作用(退出多个activity的方法)
minimicall
博客等级 码龄18年 407粉丝 174原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值