小编New*_*ton的帖子

如何在Android应用程序的listview中自动播放视频

我想从在线服务器播放listview中的视频,就像VINE app一样.并且一次只播放一个视频.但是视频视图无法在列表视图中显示.我可以查看所有其他文本,链接.但VideoView无法在listview行中显示.显示所有没有videoview.当尝试没有listview它工作正常并从在线播放视频我的listview适配器代码片段,如下所示:

mViewHolder.mVideoView.setVisibility(View.VISIBLE);
MediaController mComtroller = new MediaController(mContext);
mViewHolder.mVideoView.setMediaController(mComtroller);
mViewHolder.mVideoView.setVideoURI(Uri.parse("myLink"));
mViewHolder.mVideoView.start();
mViewHolder.mVideoView.requestFocus();
Run Code Online (Sandbox Code Playgroud)

列表视图的布局行:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:weightSum="100" >
        <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_margin="5dp"
        android:layout_weight="80"
        android:weightSum="10"
        android:orientation="horizontal"
        android:background="@drawable/background" >
            <VideoView
            android:id="@+id/vv_surface_view"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:visibility="visible"
            android:layout_weight="5" />
        <ImageView
            android:id="@+id/iv_videoThumbnail"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="5"
            android:background="@drawable/background" />
    </LinearLayout>

    <TextView
        android:id="@+id/tv_VideoName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="10"
        android:text="TextView" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text=""
        android:layout_weight="10" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android-videoview

5
推荐指数
0
解决办法
1415
查看次数

孟加拉语的文字转语音不起作用

孟加拉语内容的 TTS 在我的 Nexus 5x 中运行良好,但在其他手机中则不然。在其他即三星手机只能说英语单词但跳过(不说)孟加拉语单词。

任何人都可以获取此类问题,请帮助我。

谢谢。

代码:

@Override
    public void onInit(int i) {
        if (i == TextToSpeech.SUCCESS) {

        int result = mTextToSpeech.setLanguage(new Locale("bn_IN"));///sf/ask/558111641/

        floatRead.setImageResource(R.drawable.ic_volume_off);

        if (result == TextToSpeech.LANG_MISSING_DATA
                || result == TextToSpeech.LANG_NOT_SUPPORTED) {
            Log.i("TTS", "This Language is not supported");
            AppApplication.getInstance().showToast("This Language is not supported");
        }
        read(mNewsDetails.title, true);
        read(mNewsDetails.plain_text, false);

    } else {
        floatRead.setImageResource(R.drawable.ic_read);
    }
    }
Run Code Online (Sandbox Code Playgroud)

`

void read(String text, boolean flush) {
        if (flush == true) {
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP)
                mTextToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null, null);
            else
                mTextToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, …
Run Code Online (Sandbox Code Playgroud)

android text-to-speech google-text-to-speech

5
推荐指数
1
解决办法
2193
查看次数