android - By running the App on versions below 22 Changes some views? -


i developing app minsdkversion 11, targetsdkversion 23 , compile/build tool version 23. on android versions, 5 , 6 app works fine, installing app on versions below 22 modifies layouts, buttons , text fields disappear or color changes, me this.

manifest file

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.khan.bilal.salamrides2">  <application android:allowbackup="true" android:icon="@mipmap/cc" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> 

styles file

<resources>      <!-- base application theme. -->     <style name="apptheme" parent="theme.appcompat.light.noactionbar">         <!-- customize theme here. -->         <item name="android:windownotitle">true</item>         <item name="colorprimary">@color/colorprimary</item>         <item name="colorprimarydark">@color/colorprimarydark</item>         <item name="coloraccent">@color/coloraccent</item>     </style>      <style name="apptheme.appbaroverlay"              parent="themeoverlay.appcompat.dark.actionbar" />      <style name="apptheme.popupoverlay"                             parent="themeoverlay.appcompat.light" />  </resources> 

build gradle

apply plugin: 'com.android.application'  android {     compilesdkversion 23     buildtoolsversion "23.0.1"      defaultconfig {         applicationid "com.khan.bilal.salamrides2"         minsdkversion 11         targetsdkversion 23         versioncode 1         versionname "1.0"     }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  dependencies {     compile filetree(dir: 'libs', include: ['*.jar'])     testcompile 'junit:junit:4.12'     compile 'com.android.support:appcompat-v7:23.4.0'     compile 'com.android.support:design:23.4.0'     compile 'com.android.support:support-v4:23.4.0' } 

screen shot of android version 22(works fine) working fine

screen shot of android version below 22(problem occurs) enter image description here

when use element introduced in api 21, , try show on phone api 11, there surely problem. older versions, have differentiate between elements showing - if element not meant used in api lower 21, have provide if-else check , if api lower 21, use simple element sure supported in api 11.

for example, if want use textinputlayout, surely can, library supports api 22+, lower versions should input text adding classic edittext. add both of them xml, hide them, , based on user's api show 1 or other.

also, read document. https://developer.android.com/training/basics/supporting-devices/platforms.html

especially should idea , how it:

private void setupactionbar() { // make sure we're running on honeycomb or higher use actionbar apis if (build.version.sdk_int >= build.version_codes.honeycomb) {     actionbar actionbar = getactionbar();     actionbar.setdisplayhomeasupenabled(true);     } } 

good luck :)


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -