[Android] src: Don't hardcode 60 pixels high tab

Edward Wang git at videolan.org
Fri Jul 13 03:45:31 CEST 2012


android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Jul 12 21:45:07 2012 -0400| [53f4c90ad2ebd7c8c4db357d6b05aa36ba0f2199] | committer: Edward Wang

src: Don't hardcode 60 pixels high tab

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=53f4c90ad2ebd7c8c4db357d6b05aa36ba0f2199
---

 vlc-android/src/org/videolan/vlc/gui/AboutActivity.java |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/AboutActivity.java b/vlc-android/src/org/videolan/vlc/gui/AboutActivity.java
index cb93916..cad5a5d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AboutActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AboutActivity.java
@@ -29,6 +29,7 @@ import android.os.Bundle;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentActivity;
 import android.support.v4.app.FragmentTransaction;
+import android.util.TypedValue;
 import android.view.View;
 import android.widget.TabHost;
 import android.widget.TabHost.OnTabChangeListener;
@@ -82,7 +83,11 @@ public class AboutActivity extends FragmentActivity implements OnTabChangeListen
         mTabHost.addTab(tab_licence);
 
         for(int i = 0; i < mTabHost.getTabWidget().getChildCount(); i++) {
-            mTabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 60;
+            TextView tv = (TextView)mTabHost.getTabWidget().getChildTabViewAt(i).findViewById(android.R.id.title);
+            tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
+            //android.util.Log.d(TAG, "TextSize = " + ((Float)tv.getTextSize()).toString());
+            // Scale the tab height to the text size on the device and leave enough space
+            mTabHost.getTabWidget().getChildAt(i).getLayoutParams().height = (int)(tv.getTextSize() * 2.21);
         }
 
         mTabHost.setOnTabChangedListener(this);



More information about the Android mailing list