android原生音乐播放器界面字体显示不全

android原生音乐播放器界面字体显示不全_第1张图片



现象如图所示,有部分字体显示不全,导致界面显示异常,解决方法如下,修改文件如下:

1. alps/packages/apps/Music/src/com/android/music/MediaPlaybackActivity.java

@@ -18,6 +18,7 @@ package com.android.music;
 
 import com.android.music.MusicUtils.ServiceToken;
 
+import android.R.anim;
 import android.app.ActionBar;
 import android.app.Activity;
 import android.app.AlertDialog;
@@ -46,6 +47,7 @@ import android.os.Looper;
 import android.os.Message;
 import android.os.RemoteException;
 import android.os.SystemClock;
+import android.os.SystemProperties;
 import android.os.UserHandle;
 import android.provider.MediaStore;
 import android.provider.Settings;
@@ -159,6 +161,10 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
     private OnSwitchListener mSwitchListener = null;
     private OnShakeListener mShakeListener = null;
     /* @} */
+    
+    
+    // add for 竖屏时专辑信息显示不全
+    private boolean mShowTrackInVerticalScreen = true;
 
     public MediaPlaybackActivity()
     {
@@ -187,6 +193,10 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
             mIsFirst = true;
         }
         /* @} */
+        
+        // add for 竖屏时专辑信息显示不全
+        mShowTrackInVerticalScreen = SystemProperties.getBoolean("ro.build.showvertrack", true);
+        
         setVolumeControlStream(AudioManager.STREAM_MUSIC);
 
         mAlbumArtWorker = new Worker("album art worker");
@@ -1690,11 +1700,24 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
                 mTotalTime.setText(MusicUtils.makeTimeString(this, secs));
             }
             /* @} */
+            
+            // add for 竖屏时专辑信息显示不全
+            if(isVerticalScreen() && !mShowTrackInVerticalScreen) {
+                ((View) mArtistName.getParent()).setVisibility(View.INVISIBLE);
+                ((View) mAlbumName.getParent()).setVisibility(View.INVISIBLE);
+                ((View) mTrackName.getParent()).setVisibility(View.INVISIBLE);    
+            }
         } catch (RemoteException ex) {
             finish();
         }
     }
     
+    // add for 竖屏时专辑信息显示不全
+    private final boolean isVerticalScreen() {
+        int orientation = getResources().getConfiguration().orientation;
+        return orientation == Configuration.ORIENTATION_PORTRAIT;
+    }
+    
     public class AlbumArtHandler extends Handler {
         private long mAlbumId = -1;
         
+号所示部分均为添加部分

2. 修改相应项目的.mk文件,添加所需属性:

我的项目需要的修改文件为  alps/device/sprd/scx35l/sp9832a_3h10_volte/sp9832a_3h10_5mvolte.mk

在PRODUCT_PROPERTY_OVERRIDES +=    \  下添加

ro.build.showvertrack=false  \

之后全编即可。




你可能感兴趣的:(android)