math entities list activities refactored + categories added
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||
* For more information, please, contact se.solovyev@gmail.com
|
||||
* or visit http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.view.prefs;
|
||||
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TabHost;
|
||||
import android.widget.TextView;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 12/21/11
|
||||
* Time: 11:54 PM
|
||||
*/
|
||||
public final class AndroidUtils {
|
||||
|
||||
// not intended for instantiation
|
||||
private AndroidUtils() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public static void centerAndWrapTabsFor(@NotNull TabHost tabHost) {
|
||||
int tabCount = tabHost.getTabWidget().getTabCount();
|
||||
for (int i = 0; i < tabCount; i++) {
|
||||
final View view = tabHost.getTabWidget().getChildTabViewAt(i);
|
||||
if ( view != null ) {
|
||||
if (view.getLayoutParams().height > 0) {
|
||||
// reduce height of the tab
|
||||
view.getLayoutParams().height *= 0.8;
|
||||
}
|
||||
|
||||
// get title text view
|
||||
final View textView = view.findViewById(android.R.id.title);
|
||||
if ( textView instanceof TextView) {
|
||||
// just in case check the type
|
||||
|
||||
// center text
|
||||
((TextView) textView).setGravity(Gravity.CENTER);
|
||||
// wrap text
|
||||
((TextView) textView).setSingleLine(false);
|
||||
|
||||
// explicitly set layout parameters
|
||||
textView.getLayoutParams().height = ViewGroup.LayoutParams.FILL_PARENT;
|
||||
textView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user