android弹出输入法内存,Android弹出输入法

package com.cqgk.clerk.utils;

import android.app.Activity;

import android.graphics.Rect;

import android.view.View;

import android.view.ViewTreeObserver;

import android.widget.FrameLayout;

/**

* Created by zfx on 2016/8/23.

*/

public class ViewBugUtils {

public static void assistActivity (Activity activity) {

new ViewBugUtils(activity);

}

private View mChildOfContent;

private int usableHeightPrevious;

private FrameLayout.LayoutParams frameLayoutParams;

private int StatusHeight;

//整个布局

private ViewBugUtils(Activity activity) {

FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content);

mChildOfContent = content.getChildAt(0);

mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

public void onGlobalLayout() {

possiblyResizeChildOfContent();

}

});

frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams();

StatusHeight=getStatusHeight(activity);

}

private void possiblyResizeChildOfContent() {

int usableHeightNow = computeUsableHeight();

if (usableHeightNow != usableHeightPrevious) {

int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight();

int heightDifference = usableHeightSansKeyboard - usableHeightNow;

if (heightDifference > (usableHeightSansKeyboard/4)) {

// keyboard probably just became visible

frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;

} else {

// keyboard probably just became hidden

frameLayoutParams.height = usableHeightSansKeyboard;

}

mChildOfContent.requestLayout();

usableHeightPrevious = usableHeightNow;

}

}

private int computeUsableHeight() {

Rect r = new Rect();

mChildOfContent.getWindowVisibleDisplayFrame(r);

//        if(r.top==0){

//                r.top=StatusHeight;//状态栏目的高度

//        }

//        if(r.top!=0){

//            r.top-=StatusHeight;

//        }

System.out.println("top--------------"+r.top);

return (r.bottom - r.top);

}

public static int getStatusHeight(Activity context) {

int statusHeight = -1;

try {

Class> clazz = Class.forName("com.android.internal.R$dimen");

Object object = clazz.newInstance();

int height = Integer.parseInt(clazz.getField("status_bar_height")

.get(object).toString());

statusHeight = context.getResources().getDimensionPixelSize(height);

} catch (Exception e) {

e.printStackTrace();

}

return statusHeight;

}

}

android:name="com.cqgk.clerk.activity.active.ActiveCardActivity"

android:windowSoftInputMode="stateAlwaysHidden|adjustResize"

android:orientation="vertical"

/>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Android手机的输入法弹出时,可能有以下几个原因: 1. 输入法未启用:首先要确保输入法已经启用。可以在手机设置中的“语言和输入法”或“键盘和输入法”中查看所有安装的输入法,并选择需要使用的输入法。如果没有检测到要使用的输入法,可以尝试下载并安装相应的输入法应用程序。 2. 输入法未被选中:在应用程序中,点击文本输入框时,可能需要手动选择要使用的输入法。通过长按文本输入框,会弹出选项菜单,选择“输入法”并选择需要使用的输入法。 3. 输入法冲突:如果安装了多个输入法,可能会出现输入法冲突的情况,导致输入法无法弹出。可以尝试禁用除需要使用的输入法外的其他输入法,然后重新启动手机。 4. 软件冲突:某些应用程序可能与输入法软件存在冲突,导致无法弹出输入法。可以尝试卸载最近安装的应用程序,或在应用管理器中找到相关应用程序并清除其缓存数据。 5. 系统问题:偶尔,系统中的某些错误可能导致输入法无法弹出。可以尝试重启手机,以解决可能存在的临时问题。如果问题依然存在,可以考虑进行硬件重置或寻求专业技术支持。 总而言之,可以通过检查输入法的启用状态、选中输入法、解决输入法冲突、处理软件冲突、重启手机等方法来解决Android手机输入法弹出的问题。如果问题仍然无法解决,建议寻求专业技术支持。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值