首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >videoview的位图类

videoview的位图类
EN

Stack Overflow用户
提问于 2017-04-09 04:05:10
回答 1查看 133关注 0票数 0

我们使用imageview_and的位图类,我想知道视频视图的类是什么?

EN

回答 1

Stack Overflow用户

发布于 2017-04-09 13:04:47

** VideoView示例**

MainActivity.java

代码语言:javascript
运行
复制
  private VideoView videoView;
         private Button videoPlay;

           @Override
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
                videoView = (VideoView)findViewById(R.id.VideoView);        

    videoPlay=(Button)findViewById(R.id.button);
    videoPlay.setOnClickListener(this);

            }
 @Override
    public void onClick(View v) {
if(v==videoPlay){
videoView.setVideoPath("/sdcard/blonde_secretary.3gp");
                videoView.start(); 
}
}

main.xml

代码语言:javascript
运行
复制
 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.videotest.MainActivity">

    <VideoView
        android:id="@+id/videoview"
        android:layout_width="300dp"
        android:layout_height="200dp"/>

    <Button
        android:text="Play"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/videoview"
        android:onClick="onButtonClick"
        android:id="@+id/button"/>

</RelativeLayout>

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43299842

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档