-3
當播放視頻全屏,其他視圖在佈局中消失,但getVisibility()
回到VISIBLE
和isShown()
回到true
。 誰遇到同樣的問題,或者有很好的解決方法,請告訴我,謝謝。View是無形
這是activity_player.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/player"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<!--Used to play the video-->
<com.mediaplay.MySurfaceView
android:id="@+id/videoView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!--Used to play the marquee-->
<com.mediaplay.AutoScrollTextView
android:id="@+id/marqueeView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:textColor="@android:color/black"
android:textSize="23sp"
/>
</RelativeLayout>
它的代碼(代碼是太多了,我只能捕捉重要組成部分):
// play video
public void start() {
if (mMediaPlayer != null && mIsPrepared) {
LOG("MediaPlayer start");
mMediaPlayer.start();
}
}
// play marquee, it extends TextView
private void initTextView() {
if (marquee == null) return;
marquee.requestFocus();
marquee.setSelected(true);
marquee.bringToFront();
marquee.startScroll();
}
public void startScroll() {
isStarting = true;
invalidate();
}
- 我嘗試使用的FrameLayout相反,它不不工作
- 這裏有一些奇怪的事情,當顯示吐司或彈出式對話框時,marqueeview可以顯示,但一旦消失,marqueeview就會消失。
- 有一件事是肯定的,不要調用mediaplayer.start(),marqueeview可以顯示,但一旦調用,它會消失。
- Android4.2.2沒有probleams,android4.4.4將有probleams
有些代碼會更好看,你知道...:/ –
@Victor:如果你使用FrameLayout,請發佈一些代碼和(豎起大拇指),那麼你的視圖可能已經在背景中,所以嘗試,YOUR_VIEW。 bringToFront(); – Pawan