亲宝软件园·资讯

展开

安卓开发遇到的坑 Android UI开发中所遇到的各种坑

pigdreams 人气:0

1.软键盘隐藏问题

InputMethodManager im = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); 
im.hideSoftInputFromWindow(getCurrentFocus().getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
InputMethodManager im = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); 
if(getCurrentFocus!=null)
im.hideSoftInputFromWindow(getCurrentFocus().getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

<activity Android:windowSoftInputMode="adjustResize">

2.merge标签注意点

 android.view.InflateException: Binary XML file line 
 #2: <merge /> can be used only with a valid ViewGroup root and attachToRoot=true
   Caused by: android.view.InflateException: <merge /> can be used only with a valid ViewGroup root and attachToRoot=true

3.LinearLayout注意点

4. 布局选择

FrameLayout是最简单的一种布局,所有安卓界面的根布局都是FrameLayout,加载速度最快。

LinearLayou布局与RelativeLayout布局的加载速度需要进一步深入的研究才能得出具体结论。

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。如果你想了解更多相关内容请查看下面相关链接

加载全部内容

相关教程
猜你喜欢
用户评论