Android exoplayer上的“下一步”按钮不工作时保持禁用状态
我的exoplayer代码如下Android exoplayer上的“下一步”按钮不工作时保持禁用状态,android,android-studio,exoplayer,Android,Android Studio,Exoplayer,我的exoplayer代码如下 <com.google.android.exoplayer2.ui.PlayerView android:id="@+id/player_view" android:layout_width="match_parent" android:layout_height="250dp" android:background="#fff" andr
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/player_view"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="#fff"
android:focusable="true"
app:controller_layout_id="@layout/custom_controls"
app:fastforward_increment="10000"
app:hide_on_touch="true"
app:player_layout_id="@layout/exo_simple_player_view"
app:resize_mode="fill"
app:rewind_increment="10000"
app:show_timeout="5000"
app:use_controller="true"
/>
exo_下一个btn保持禁用状态。未应用单击侦听器。我不明白为什么。是否有其他地方可以禁用此btn表单。exo_prev btn工作正常。请帮我找出我做错了什么
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layoutDirection="ltr"
android:background="#CC000000"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="4dp"
android:orientation="horizontal">
<ImageButton android:id="@id/exo_prev"
style="@style/ExoMediaButton.Previous"/>
<ImageButton
android:id="@id/exo_rew"
style="@style/ExoMediaButton.Rewind"
android:visibility="gone" />
<ImageButton android:id="@id/exo_repeat_toggle"
style="@style/ExoMediaButton"/>
<ImageButton android:id="@id/exo_play"
style="@style/ExoMediaButton.Play"/>
<ImageButton android:id="@id/exo_pause"
style="@style/ExoMediaButton.Pause"/>
<ImageButton
android:id="@id/exo_ffwd"
style="@style/ExoMediaButton.FastForward"
android:visibility="gone" />
<ImageButton android:id="@id/exo_next"
style="@style/ExoMediaButton.Next"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView android:id="@id/exo_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textStyle="bold"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:includeFontPadding="false"
android:textColor="#FFBEBEBE"/>
<com.google.android.exoplayer2.ui.DefaultTimeBar
android:id="@id/exo_progress"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="26dp"/>
<TextView android:id="@id/exo_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textStyle="bold"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:includeFontPadding="false"
android:textColor="#FFBEBEBE"/>
<FrameLayout
android:id="@+id/exo_fullscreen_button"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="right">
<ImageView
android:id="@+id/exo_fullscreen_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/ic_fullscreen_expand"/>
</FrameLayout>
</LinearLayout>
</LinearLayout>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout android:id="@id/exo_content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<!-- Video surface will be inserted as the first child of the content frame. -->
<View android:id="@id/exo_shutter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"/>
<ImageView android:id="@id/exo_artwork"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"/>
<com.google.android.exoplayer2.ui.SubtitleView android:id="@id/exo_subtitles"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ProgressBar android:id="@id/exo_buffering"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
android:layout_gravity="center"/>
<TextView android:id="@id/exo_error_message"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@color/exo_error_message_background_color"
android:padding="16dp"/>
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
<FrameLayout android:id="@id/exo_ad_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<FrameLayout android:id="@id/exo_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<View android:id="@id/exo_controller_placeholder"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</merge>
private ImageView exo_prev, exo_next;
private void initFullscreenButton() {
PlayerControlView controlView = playerView.findViewById(R.id.exo_controller);
exo_prev = controlView.findViewById(R.id.exo_prev);
exo_next = controlView.findViewById(R.id.exo_next);
initNextandPreviousButton();
});
private void initNextandPreviousButton() {
if (exo_prev == null) {
return;
}
if (exo_next == null) {
return;
}
if (lessonList == null) {
return;
}
if (currentVideoPosition == 0) {
exo_prev.setVisibility(View.INVISIBLE);
exo_next.setVisibility(View.VISIBLE);
}
if (currentVideoPosition == lessonList.size() - 1) {
exo_next.setVisibility(View.INVISIBLE);
exo_prev.setVisibility(View.VISIBLE);
}
exo_next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
consolelog("onclick exo_next"+position,"ocp","v");
if (currentVideoPosition == lessonList.size() - 1) {
currentVideoPosition = currentVideoPosition + 1;
currentVideoUrl = lessonList.get(currentVideoPosition).getVideoUrl();
initializePlayer();
lessonAdapter.setTickVisoble(currentVideoPosition);
}
}
}
);
exo_prev.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
consolelog("onclick exo_prev"+position,"ocp","v");
if(currentVideoPosition>0) {
currentVideoPosition = currentVideoPosition - 1;
currentVideoUrl = lessonList.get(currentVideoPosition).getVideoUrl();
initializePlayer();
lessonAdapter.setTickVisoble(currentVideoPosition);
}
}
});
}