Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid ActionBar Tab issues with versions and Android Studio
    primarykey
    data
    text
    <p>I'm developing an application and do not want to be backward compatible lower than 4.2. I just want to add an Actionbar with Tabs and ViewPager enabled. But there are issues with the ActionBar.</p> <p>I followed the tutorial below which is using the v4 support library: <a href="http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/" rel="nofollow">http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/</a></p> <p>But android.app.ActionBar is not working with the v4 support library. According to other descriptions one should add the support library v7 which contains android.support.v7.app.ActionBar. I did not have the v7 support library included so I've tried following the Android manual to add the v7 library support: <a href="http://developer.android.com/tools/support-library/setup.html" rel="nofollow">http://developer.android.com/tools/support-library/setup.html</a></p> <p><strong>MainActivity.java includes</strong></p> <pre><code>import android.support.v7.app.ActionBar; // does not exist!!! import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; public class MainActivity extends FragmentActivity implements ActionBar.TabListener { ... } </code></pre> <p>When I use "import android.app.ActionBar" I get following error message: "error: MainActivity is not abstract and does not override abstract method onTabReselected(Tab,FragmentTransaction) in TabListener"</p> <p><strong>build.gradle</strong></p> <pre><code>buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.6.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.0.0" defaultConfig { minSdkVersion 14 targetSdkVersion 19 } } dependencies { compile 'com.android.support:support-v13:+' compile "com.android.support:support-v4:18.0.+" compile 'com.android.support:support-v4:+' compile files('libs/core-2.3.0.jar', 'libs/android-integration-2.3.0-supportv4.jar') } </code></pre> <p>But I also get the message that the ActionBar was not found.</p> <p>Can somebody tell me how I can add an ActionBar with Tabs and ViewPager? It does not have to be backwards compatible lower then 4.2.</p> <p>These support libraries and version differencies do get me confused and there's no real documentation based on the latest version.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload