Android 项目 UI混乱,Button变大,解决方案
2016-04-25 11:41
302 查看
最近公司项目中,脑袋一大随手修改了一下targetSdkVersion,改成了21(原来是19以下)。结果遇到的问题就是Viewpagerindicator的指示器不能正常显示。具体怎么不能正常显示姑且理解为部分UI乱套了就好了。
我看了下4.4系统api的说明,在Build.java类里面
里面有句话说了android.widget.RelativeLayout} changes to compute wrapped content margins correctly,说重新修改了RelativeLayout计算margin的方式。。。。
4.0源码的makeMeasureSpec是这样实现的:
Button变大这个问题可以在你的AppThemes里面加上下面这句话解决:
我看了下4.4系统api的说明,在Build.java类里面
''' /** * <a href="http://www.it165.net/pro/ydad/" target="_blank" class="keylink">Android</a> 4.4: KitKat, another tasty treat. * * <p>Applications targeting this or a later release will get these * new changes in behavior:</p> * <ul> * <li> The default result of {android.preference.PreferenceActivity#isValidFragment * PreferenceActivity.isValueFragment} becomes false instead of true.</li> * <li> In {@link android.webkit.WebView}, apps targeting earlier versions will have * JS URLs evaluated directly and any result of the evaluation will not replace * the current page content. Apps targetting KITKAT or later that load a JS URL will * have the result of that URL replace the content of the current page</li> * <li> {@link android.app.AlarmManager#set AlarmManager.set} becomes interpreted as * an inexact value, to give the system more flexibility in scheduling alarms.</li> * <li> {@link android.content.Context#getSharedPreferences(String, int) * Context.getSharedPreferences} no longer allows a null name.</li> * <li> {@link android.widget.RelativeLayout} changes to compute wrapped content * margins correctly.</li> * <li> {@link android.app.ActionBar}'s window content overlay is allowed to be * drawn.</li> * <li>The {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} * permission is now always enforced.</li> * <li>Access to package-specific external storage directories belonging * to the calling app no longer requires the * {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} or * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} * permissions.</li> * </ul> */ public static final int KITKAT = 19;
里面有句话说了android.widget.RelativeLayout} changes to compute wrapped content margins correctly,说重新修改了RelativeLayout计算margin的方式。。。。
4.0源码的makeMeasureSpec是这样实现的:
/** * Creates a measure specification based on the supplied size and * * The mode must always be one of the following: * <ul> * <li>{@link android.view.View.MeasureSpec#UNSPECIFIED}</li> * <li>{@link android.view.View.MeasureSpec#EXACTLY}</li> * <li>{@link android.view.View.MeasureSpec#AT_MOST}</li> * </ul> * * @param size the size of the measure specification * @param mode the mode of the measure specification * @return the measure specification based on size and mode */ public static int makeMeasureSpec(int size, int mode) { return size + mode; }
Button变大这个问题可以在你的AppThemes里面加上下面这句话解决:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:buttonStyle">@android:style/Widget.Button.Small</item> </style>
所以说问题就出现在这了!!!!总的来说要是嫌麻烦就改回19以下,不嫌麻烦把写错的方法改一下或用的库就更新一下。
相关文章推荐
- 使用C++实现JNI接口需要注意的事项
- Android IPC进程间通讯机制
- Android Manifest 用法
- [转载]Activity中ConfigChanges属性的用法
- Android之获取手机上的图片和视频缩略图thumbnails
- Android之使用Http协议实现文件上传功能
- Android学习笔记(二九):嵌入浏览器
- android string.xml文件中的整型和string型代替
- i-jetty环境搭配与编译
- android之定时器AlarmManager
- android wifi 无线调试
- Android Native 绘图方法
- Android java 与 javascript互访(相互调用)的方法例子
- android 代码实现控件之间的间距
- android FragmentPagerAdapter的“标准”配置
- Android"解决"onTouch和onClick的冲突问题
- android:installLocation简析
- android searchView的关闭事件
- SourceProvider.getJniDirectories