视频播放
This commit is contained in:
parent
6075a2c6d7
commit
32ea596bec
|
@ -5,8 +5,11 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
import android.widget.VideoView;
|
import android.widget.VideoView;
|
||||||
|
|
||||||
public class Message1Activity extends AppCompatActivity {
|
public class Message1Activity extends AppCompatActivity {
|
||||||
|
@ -18,21 +21,24 @@ public class Message1Activity extends AppCompatActivity {
|
||||||
setContentView(R.layout.activity_message1);
|
setContentView(R.layout.activity_message1);
|
||||||
ImageView imageView14=findViewById(R.id.imageView14);
|
ImageView imageView14=findViewById(R.id.imageView14);
|
||||||
videoView = findViewById(R.id.videoView2);
|
videoView = findViewById(R.id.videoView2);
|
||||||
videoView.setOnClickListener(new View.OnClickListener() {
|
TextView textView1=findViewById(R.id.textView39);
|
||||||
|
TextView textView2=findViewById(R.id.textView36);
|
||||||
|
textView1.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
videoView.setVideoURI(Uri.parse("android.resource://"+getPackageName()+"/raw/"+R.raw.golden));
|
videoView.setVideoURI(Uri.parse("android.resource://"+getPackageName()+"/raw/"+R.raw.golden));
|
||||||
videoView.start();
|
videoView.start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// findViewById(R.id.button7).setOnClickListener(new View.OnClickListener() {
|
|
||||||
// @Override
|
textView2.setOnClickListener(new View.OnClickListener() {
|
||||||
// public void onClick(View v) {
|
@Override
|
||||||
// if (videoView.isPlaying()){
|
public void onClick(View v) {
|
||||||
// videoView.pause();
|
if (videoView.isPlaying()){
|
||||||
// }
|
videoView.pause();
|
||||||
// }
|
}
|
||||||
// });
|
}
|
||||||
|
});
|
||||||
imageView14.setOnClickListener(new View.OnClickListener() {
|
imageView14.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
|
@ -112,6 +112,28 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/imageView16" />
|
app:layout_constraintTop_toBottomOf="@+id/imageView16" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView39"
|
||||||
|
android:layout_width="56dp"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:text="播放"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/imageView16"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView36"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:text="暂停"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/imageView16"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue