Month: June 2015

[Q&A]How to center icon using customView in actionbar

1
2
3
4
5
6
7
ActionBar.LayoutParams layoutParams = 
new ActionBar.LayoutParams(
   ActionBar.LayoutParams.MATCH_PARENT,
   ActionBar.LayoutParams.MATCH_PARENT);
layoutParams.gravity = Gravity.CENTER_HORIZONTAL|Gravity.CENTER_HORIZONTAL;
View customView = getLayoutInflater().inflate(R.layout.actionbar_custom_view, null);
actionBar.setCustomView(customView, layoutParams);
Tags :

[Q&A] tabs appearing ABOVE actionbar with custom view in NAVIGATION_MODE_TABS

1
2
3
4
5
6
actionBar.setLogo(new ColorDrawable(Color.TRANSPARENT));
View homeIcon = findViewById(
   Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? 
   android.R.id.home : R.id.abs__home);
((View) homeIcon.getParent()).setLayoutParams(new LinearLayout.LayoutParams(0, 0));
((View) homeIcon).setVisibility(View.GONE);
Tags :

[Q&A] How to solve “Gradle project sync failed. Please fix your project and try again”

1
File -> Invalidate caches / Restart
Tags : ,

[Q&A] android Build.CPU_ABI returns wrong cpu type

there is an experience,
in certain android x86 phone, with certain android os version,

a bundle APK includes

/libs/armeabi/a.so
/libs/armeabi-v7a/a.so
/libs/armeabi-v7a/b.so
/libs/x86/a.so
/libs/x86/b.so

String cpu = Build.CPU_ABI; // armeabi-v7a is returned which is wrong, but in other x86 phones, “x86″ is returned correctly

however, if /libs/armeabi/b.so is added back, or /libs/armeabi is removed

String cpu = Build.CPU_ABI; // x86 is returned correctly

I have not figured out the cause yet,
just keep in mind, there must be same amount shared libraries in each arch folders.

Tags : ,