我使用ANDROID ACTION BAR STYLE GENERATOR创建了一个动作栏样式我复制了生成的主题并将其集成到我的应用程序中但是当我运行应用程序时,操作栏模糊http://postimg.org/image/ox2saxhkt/是一个屏幕截图,它是如何看的
我已经搜索了网络和堆栈溢出,但在我完成重建之前,我还没有看到任何人遇到此类问题我已经测试了不同的模拟器,它仍然是同样我甚至删除了4.4W和4.4L并使用4.4.2库来构建它但没有成功
注意:我在Linux Kubuntu上运行。
这是下面的代码
package com.pico;
import com.pico.sales.R;
import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.os.Bundle;
import android.support.v4.app.Fragment;
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 Set extends FragmentActivity implements
ActionBar.TabListener {
CollectionPagerAdapter mCollectionPagerAdapter;
ViewPager mViewPager;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mCollectionPagerAdapter = new CollectionPagerAdapter(
getSupportFragmentManager());
final ActionBar actionBar = getActionBar();
actionBar.setHomeButtonEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mCollectionPagerAdapter);
mViewPager
.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
actionBar.setSelectedNavigationItem(position);
}
});
for (int i = 0; i < mCollectionPagerAdapter.getCount(); i++) {
actionBar.addTab(actionBar.newTab()
.setText(mCollectionPagerAdapter.getPageTitle(i))
.setTabListener(this));
}
}
@Override
public void onTabReselected(Tab tab, android.app.FragmentTransaction fragmentTransaction) {
// TODO Auto-generated method stub
}
@Override
public void onTabSelected(Tab tab, android.app.FragmentTransaction fragmentTransaction) {
// TODO Auto-generated method stub
mViewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(Tab tab, android.app.FragmentTransaction fragmentTransaction) {
// TODO Auto-generated method stub
}
public class CollectionPagerAdapter extends FragmentPagerAdapter {
final int NUM_ITEMS = 4; // number of tabs
public CollectionPagerAdapter(FragmentManager fm) {
super(fm);
}
/** This method will be invoked when a page is requested to create */
@Override
public Fragment getItem(int position) {
switch(position) {
case 0:
return new Tab1();
case 1:
return new Tab2();
case 2:
return new Tab3();
case 3:
return new Tab4();
default:
return null;
}
}
@Override
public int getCount() {
return NUM_ITEMS;
}
@Override
public CharSequence getPageTitle(int position) {
String tabLabel = null;
switch (position) {
case 0:
tabLabel = "Dashboard";
break;
case 1:
tabLabel = "Invoices";
break;
case 2:
tabLabel = "Inventory";
break;
case 3:
tabLabel = "Reports";
break;
}
return tabLabel;
}
}
}
这是清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pico.sales"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="19"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Pico" >
<activity
android:name="com.pico.MainActivity"
android:label="Please Login" >
<intent-filter>
<action android:name="android.intent.action.START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.Splash"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.pico.Set"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.SET" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.Register"
android:label="Setup Your Account"
android:icon="@drawable/new_user" >
<intent-filter>
<action android:name="android.intent.action.REGISTER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.Setup"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.SETUP" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.Items"
android:parentActivityName="com.pico.Set" >
<!-- Parent activity meta-data to support API level 7+ -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.pico.Set"
android:label="Items" >
</meta-data>
<intent-filter>
<action android:name="android.intent.action.ITEMS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.No_items"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.NO_ITEMS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.Pricing"
android:parentActivityName="com.pico.Set" >
<!-- Parent activity meta-data to support API level 7+ -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.pico.Set"
android:label="Pricing Schemes" >
</meta-data>
<intent-filter>
<action android:name="android.intent.action.PRICING" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.No_pricing"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.NO_PRICING" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:icon="@drawable/new_user"
android:name="com.pico.Customers"
android:parentActivityName="com.pico.Set" >
<!-- Parent activity meta-data to support API level 7+ -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.pico.Set"
android:label="Customers" >
</meta-data>
<intent-filter>
<action android:name="android.intent.action.CUSTOMERS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:icon="@drawable/new_user"
android:name="com.pico.No_customers" >
<intent-filter>
<action android:name="android.intent.action.NO_CUSTOMERS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:icon="@drawable/new_user"
android:name="com.pico.Add_customer"
android:parentActivityName="com.pico.Customers" >
<!-- Parent activity meta-data to support API level 7+ -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.pico.Customers"
android:label="Add_customer" >
</meta-data>
<intent-filter>
<action android:name="android.intent.action.ADD_CUSTOMER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>