0
我想使用的代碼,以播放視頻的切換的RelativeLayout - 下面的代碼工作正常
Android的 - 在最前的視頻視圖
private VideoView mVideoView;
mVideoView = (VideoView) findViewById(R.id.vvCarView360);
mVideoView.setVideoPath(path);
mVideoView.requestFocus();
mVideoView.setOnTouchListener(this);
mVideoView.start();
rlBottomBar = (RelativeLayout) findViewById(R.id.rlView360BottomBar);
現在就點擊這個videoview我試圖顯示一個包含一些圖標的欄。給出了酒吧的佈局如下─
編輯:添加了完整的XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<VideoView
android:id="@+id/vvCarView360"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true" />
<RelativeLayout
android:id="@+id/rlView360BottomBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="invisible" >
<ImageView
android:id="@+id/ivView360Backbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:focusable="true"
android:focusableInTouchMode="true" />
<ImageView
android:id="@+id/ivView360Playbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:focusable="true"
android:focusableInTouchMode="true" />
<ImageView
android:id="@+id/ivView360Homebtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:focusable="true"
android:focusableInTouchMode="true" />
</RelativeLayout>
的ontouch聽衆 -
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
switch (v.getId()) {
case R.id.vvCarView360:
if (mVideoView.isPlaying()) {
mVideoView.pause();
} else {
mVideoView.start();
}
break;
}
}
rlBottomBar.setVisibility(View.VISIBLE); **// This line not getting executed.**
return true;
}
我可以看到視頻越來越暫停/恢復。這意味着觸摸監聽器正在執行。 不知道爲什麼底欄不可見。任何幫助將不勝感激。
你必須在這裏添加完整的XML代碼才能得到答案。它看起來像你的相對佈局是由VideoView重疊?檢查 – TNR 2013-02-11 09:20:07
@TNR:添加完整的XML。 – Anukool 2013-02-11 09:24:32
將此添加到您的'rlView360BottomBar':'android:layout_below =「@ id/vvCarView360」'。 – 2013-02-11 09:52:47