键盘带自己的头像那个是怎么弄的?

Copyright & 2015
豫ICP备号-2
All Rights Reserved.
Powered By一边是键盘一边是照片的头像怎么做出来的?_百度知道
一边是键盘一边是照片的头像怎么做出来的?
我有更好的答案
然后截图就可以,然后添加自己照片,用ps或者或者picsart软件可以做出相应的效果来,特别好看。加我V号👇(lixin282389)代做照片键盘是在你手机自带的备忘录或记事本里面打出想要的字
ps或者picsart
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁巧妙地处理带头像的登录界面键盘遮挡问题 - 推酷
巧妙地处理带头像的登录界面键盘遮挡问题
登录界面输入用户名或者密码键盘抬起导致的遮盖问题是个老问题了,网上有很多类似的解决方案。如果你恰好在登录界面还有个头像的话,如何优雅的处理这个头像呢?目前最新版本的手机QQ的处理也是比较醉人——直接在下方留出一大片白,这样子就避免了遮盖的问题(“ ”)。
但是本人总觉得不好看,这里本文将给出一个巧妙地处理头像和遮盖问题的例子。键盘隐藏和打开的效果图如下:
键盘弹出后总结起来主要是两点:
1. 输入区域包括登录按钮整体上抬
2. 原来的头像缩小到右上角
做到这个很简单,仅仅需要在AndroidManifest中对应的Activity的元素中加入windowSoftInputMode属性:
android:name=&.activity.LoginActivity&
android:label=&@string/login_button_text&
android:launchMode=&singleTask&
android:windowSoftInputMode=&stateHidden|stateUnchanged|adjustResize&/&
于是运行后跑起来发现登录界面变成了这样:
这显然不是我们想要的,虽然整体上抬了,但是登录按钮却依然被遮盖。输入完毕用户名密码后必须要先关闭输入法才能点击到登录按钮,等于多了一步操作。
那么到这里我们就想到了是否可以拿这个头像做文章?可以看到头像占据了很大的空间,那么是否可以在键盘抬起的时候我们调整头像的大小以及位置呢?答案是可以得,但是首先我们要做的是知道何时键盘打开或者关闭,其次再来改变这个头像。
监控键盘的状态
这个Activity的根布局是一个RelativeLayout (文章最后会给出完整的布局):
&?xml version=&1.0& encoding=&utf-8&?&
&RelativeLayout xmlns:android=&/apk/res/android&
xmlns:app=&/apk/res-auto&
android:id=&@+id/login_root&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:background=&@drawable/shape_login_bg_start&&
&/RelativeLayout&
由于上面键盘抬起的时候那个checkbox依然可以点击到,所以我们这里做个测试,键盘分别是关闭和打开的时候,点击checkbox来计算下这个根布局RelativeLayout的高度是否在变化,添加的测试代码为:
@Bind(R.id.login_root)
RelativeLayout mR
pwdCheck.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
L.d(&root view height : & + mRoot.getHeight());
依次在键盘隐藏和抬起的时候点击checkbox来查看下log:
11-25 14:27:28.710 /com.qianmi.shine D/shine: root view height : 1860
11-25 14:27:31.240 /com.qianmi.shine D/shine: root view height : 1033
发现这个RelativeLayout的高度在键盘隐藏和抬起的时候是在变化的,那么它的onSideChange这个函数肯定是一直在被调用的。所以我们可以自己继承一个RelativeLayout,同时复写它的onSizeChange函数,通过高度的变化来判断键盘是否打开,同时暴露出一个接口给Activity实现,让Activity在该接口中根据键盘的状态来改变头像的布局。这个自定义的继承自RelativeLayout的控件如下:
public class ResizeRelativeLayout extends RelativeLayout {
public static final int HIDE = 0;
public static final int SHOW = 1;
private Handler mainHandler = new Handler();
public ResizeRelativeLayout(Context context) {
super(context);
// TODO Auto-generated constructor stub
public ResizeRelativeLayout(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
protected void onSizeChanged(int w,final int h, int oldw,final int oldh) {
// TODO Auto-generated method stub
super.onSizeChanged(w, h, oldw, oldh);
mainHandler.post(new Runnable() {
public void run() {
if (oldh - h & 50){
keyBordStateListener.onStateChange(SHOW);
if(keyBordStateListener != null){
keyBordStateListener.onStateChange(HIDE);
protected void onLayout(boolean changed, int l, int t, int r, int b) {
// TODO Auto-generated method stub
super.onLayout(changed, l, t, r, b);
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// TODO Auto-generated method stub
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
private KeyBordStateListener
keyBordStateL
public void setKeyBordStateListener(KeyBordStateListener keyBordStateListener) {
this.keyBordStateListener = keyBordStateL
public interface KeyBordStateListener{
public void onStateChange(int state);
在onSizeChange中判断当前的height如果大于过去的height,即说明键盘是隐藏了;反之就是显示了。
Activity对应的修改如下:
@Bind(R.id.login_root)
ResizeRelativeLayout mR
public void onStateChange(int state) {
switch (state) {
case ResizeRelativeLayout.HIDE:
//TODO when keyboard is hide
case ResizeRelativeLayout.SHOW:
//TODO when keyboard is show
mRoot.setKeyBordStateListener(this);
头像的变化
有了键盘状态的监听后,头像变化的处理就变的随性了。为了简单起见,这里我们在根布局的右上角同样放置了一个ImageView,他和原来的头像ImageView显示同样的内容。当键盘弹起的时候显示右上角的头像而隐藏中间的大头像(注意一定要设置为Gone,这样子的话布局在onMeasure的时候才会把原来属于大头像的空间腾出来从而让下方的输入框和登录按钮向上抬起的更多);当键盘隐藏的时候则显示中间大头像而隐藏右上角的头像。
修改onStateChange为:
@Bind(R.id.card_small)
CardView cardS
@Bind(R.id.card)
public void onStateChange(int state) {
switch (state) {
case ResizeRelativeLayout.HIDE:
card.setVisibility(View.VISIBLE);
cardSmall.setVisibility(View.INVISIBLE);
case ResizeRelativeLayout.SHOW:
card.setVisibility(View.GONE);
cardSmall.setVisibility(View.VISIBLE);
(这里需要注明的是,为了让ImageView带阴影,特意用了一个CardView来包含ImageView,因为CardView自带阴影效果,所以这里即对CardView进行可见性变化,具体见文末的布局完整文件;其次这里为了做出带圆角的ImageView,用了别的人一个控件,
RoundedImageView
如果需要做的带感的话,可以对中间的大头像做如下的属性动画(一定要是属性动画,因为这样才能真正的“移动”而腾出空间)而不用显示另一个右上角的小头像:
1. ImageView通过scaleX和scaleY来缩小size
2. ImageView通过translateX和translateY来移动到右上角
附完整的布局文件:
&?xml version=&1.0& encoding=&utf-8&?&
&com.qianmi.shine.widget.ResizeRelativeLayout xmlns:android=&/apk/res/android&
xmlns:app=&/apk/res-auto&
android:id=&@+id/login_root&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:background=&@drawable/shape_login_bg_start&&
&android.support.v7.widget.CardView
android:id=&@+id/card_small&
android:layout_width=&40dp&
android:layout_height=&40dp&
android:layout_alignParentRight=&true&
android:layout_alignParentTop=&true&
android:layout_margin=&20dp&
android:visibility=&invisible&
app:cardBackgroundColor=&@color/transparent&
app:cardCornerRadius=&2dp&
app:cardElevation=&2dp&&
&com.makeramen.roundedimageview.RoundedImageView
android:id=&@+id/profile_small&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:background=&@drawable/login_btn_photo_l&
android:scaleType=&fitCenter&
android:src=&@drawable/photo_l&
app:riv_corner_radius=&2dp& /&
&/android.support.v7.widget.CardView&
&LinearLayout
android:layout_width=&315dp&
android:layout_height=&wrap_content&
android:layout_centerInParent=&true&
android:layout_marginLeft=&20dp&
android:layout_marginRight=&20dp&
android:orientation=&vertical&&
&android.support.v7.widget.CardView
android:id=&@+id/card&
android:layout_width=&98dp&
android:layout_height=&98dp&
android:layout_gravity=&center_horizontal&
android:layout_marginBottom=&@dimen/login_input_height&
app:cardBackgroundColor=&@color/transparent&
app:cardCornerRadius=&2dp&
app:cardElevation=&2dp&&
&com.makeramen.roundedimageview.RoundedImageView
android:id=&@+id/profile&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:background=&@drawable/login_btn_photo_l&
android:scaleType=&fitCenter&
android:src=&@drawable/photo_l&
app:riv_corner_radius=&2dp& /&
&/android.support.v7.widget.CardView&
android:id=&@+id/et_login_username&
android:layout_width=&match_parent&
android:layout_height=&@dimen/login_input_height&
android:layout_marginLeft=&@dimen/login_margin_left&
android:background=&@drawable/shape_solid_transparent&
android:drawableLeft=&@drawable/login_icon_company&
android:drawablePadding=&@dimen/login_padding&
android:hint=&@string/login_input_hint_username&
android:inputType=&textPersonName&
android:singleLine=&true&
android:textColor=&@color/ColorPrimary&
android:textColorHint=&@color/text_hint_color&
android:textCursorDrawable=&@drawable/common_input_cursor&
android:textSize=&@dimen/login_input_text_size& /&
android:id=&@+id/line1&
style=&@style/common_login_horizontalLine_matchParent_normal& /&
android:id=&@+id/et_login_employ_name&
android:layout_width=&match_parent&
android:layout_height=&@dimen/login_input_height&
android:layout_marginLeft=&@dimen/login_margin_left&
android:background=&@drawable/shape_solid_transparent&
android:drawableLeft=&@drawable/login_icon_man&
android:drawablePadding=&@dimen/login_padding&
android:hint=&@string/login_input_hint_employ&
android:inputType=&textPersonName&
android:singleLine=&true&
android:textColor=&@color/ColorPrimary&
android:textColorHint=&@color/text_hint_color&
android:textCursorDrawable=&@drawable/common_input_cursor&
android:textSize=&@dimen/login_input_text_size& /&
android:id=&@+id/line2&
style=&@style/common_login_horizontalLine_matchParent_normal& /&
android:id=&@+id/et_login_pwd&
android:layout_width=&match_parent&
android:layout_height=&@dimen/login_input_height&
android:layout_marginLeft=&@dimen/login_margin_left&
android:background=&@drawable/shape_solid_transparent&
android:drawableLeft=&@drawable/login_icon_lock&
android:drawablePadding=&@dimen/login_padding&
android:hint=&@string/login_input_hint_pwd&
android:inputType=&textPassword&
android:singleLine=&true&
android:textColor=&@color/ColorPrimary&
android:textColorHint=&@color/text_hint_color&
android:textCursorDrawable=&@drawable/common_input_cursor&
android:textSize=&@dimen/login_input_text_size& /&
android:id=&@+id/line3&
style=&@style/common_login_horizontalLine_matchParent_normal& /&
android:id=&@+id/remember_pwd&
style=&@style/RememberPasswordCheckBox&
android:layout_marginLeft=&@dimen/login_margin_left&
android:text=&@string/login_remember_pwd& /&
android:id=&@+id/btn_login&
android:layout_width=&match_parent&
android:layout_height=&46dp&
android:layout_gravity=&center_horizontal&
android:layout_marginTop=&32dp&
android:background=&@drawable/common_green_btn_selector&
android:focusable=&true&
android:text=&@string/login_button_text&
android:textColor=&@color/text_button_login&
android:textSize=&@dimen/login_btn_text_size& /&
&/LinearLayout&
&/com.qianmi.shine.widget.ResizeRelativeLayout&
已发表评论数()
已收藏到推刊!
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见
正文不准确
排版有问题
没有分页内容
视频无法显示
图片无法显示照片带键盘文字的头像怎么制作?_百度知道
照片带键盘文字的头像怎么制作?
2.直接抓图.就OK了.抓图/保存.把聊天背景用自己喜欢的照片替代.另外输入法看看有没有自定义.jpg" target="_blank" title="点击查看大图" class="ikqb_img_alink"><img class="ikqb_img" src="http.<a href="http.jpg" esrc="http,工具有橡皮擦的://c.baidu.hiphotos.第一张照片.4.这样是最简单的方法了.com/zhidao/wh%3D600%2C800/sign=a95ce91a13ce36d3a6bf/86df0708dad13fc0ef24b899a801f21e.手机版.2.透明度调节为48左右,慢慢擦亮,与人聊天打上字,橡皮擦工具调节百分之五十的透明度,导入二张照片.3.这时你展开输入法.0 官方中文 软件.可以开通QQ会员,在手机上打开任何一个可以聊天或者可以输入字体的对话框输入字体.用软件里编辑的绘画中的橡皮擦工具,在二张照片融合处慢慢擦出来就OK了,什么软件都不用.可以把输入法的皮肤换成自己的照片.保存/抓图/5.还有一个最简单的方法.baidu.把一张背景照片与抓图的照片在同时打开.1.输入法键盘展开.下载PicsArt照片艺术家 3://c0,在二张照片融合处.hiphotos.用手机上任何一个软件中./zhidao/wh%3D450%2C600/sign=44e91a033c87edf0708dad13fc0ef24b899a801f21e.调节角度.com/zhidao/pic/item/86df0708dad13fc0ef24b899a801f21e://c.baidu
其他类似问题
为您推荐:
其他1条回答
可以美化图片啊,在写上你要打的文字、
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

 

随机推荐