Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Flash视频不会使用ViewFlipper滑动_Android_Flash_Viewflipper - Fatal编程技术网

Android Flash视频不会使用ViewFlipper滑动

Android Flash视频不会使用ViewFlipper滑动,android,flash,viewflipper,Android,Flash,Viewflipper,你好,我做这个已经有一段时间了。我使用GestureListener和ViewFlipper在两个不同的Web视图之间滑动。一个webview是聊天,另一个是flash流。蒸汽是全屏的,当我刷卡时它不会离开屏幕。聊天刷,但它不会返回时,我刷回来。当我改变方向时,我可以看到下面的聊天。请帮忙 手势正常,但视频无法移动。我怎样才能把它移到后面 public class WebViewPager extends Activity implements SimpleGestureListener {

你好,我做这个已经有一段时间了。我使用GestureListener和ViewFlipper在两个不同的Web视图之间滑动。一个webview是聊天,另一个是flash流。蒸汽是全屏的,当我刷卡时它不会离开屏幕。聊天刷,但它不会返回时,我刷回来。当我改变方向时,我可以看到下面的聊天。请帮忙

手势正常,但视频无法移动。我怎样才能把它移到后面

public class WebViewPager extends Activity implements SimpleGestureListener {

private FrameLayout holder;
private WebView streamView;
private WebView chatView;
private ViewFlipper flipView;
private ProgressDialog pDialog;
private String url = "http://www.justin.tv/dbz_hd2/popout";
private String url2 = "http://www.justin.tv/chat/embed?channel=dbz_hd2";
private SimpleGestureFilter filter;
private Animation slideLeft;
private Animation slideRight;

final Activity activity = this;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_layout);
    holder = (FrameLayout) findViewById(R.id.streamViewHolder);
    streamView = (WebView) findViewById(R.id.streamView);
    StreamClientSettings();


    flipView = (ViewFlipper) findViewById(R.id.mainFlipper);
    flipView.setDisplayedChild(1);
    this.filter = new SimpleGestureFilter(this, this);
    this.filter.setMode(SimpleGestureFilter.MODE_TRANSPARENT);

    slideLeft = AnimationUtils.loadAnimation(this, R.anim.translate);
    slideRight = AnimationUtils.loadAnimation(this, R.anim.translate);

    new ManageViews().execute();
}


private class ManageViews extends AsyncTask<Void, Void, Void> {

    @Override
    protected Void doInBackground(Void... args) {
        // TODO Auto-generated method stub

        chatView = (WebView) findViewById(R.id.chatView);
        ChatClientSettings();

        return null;
    }

}


@Override
public boolean dispatchTouchEvent(MotionEvent me) {
    this.filter.onTouchEvent(me);
    return super.dispatchTouchEvent(me);    
}


public void StreamClientSettings() {

//      streamView = new WebView(this);
//      streamView.setLayoutParams(new ViewGroup.LayoutParams(
//              LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    streamView.getSettings().setPluginState(PluginState.ON);
    streamView.getSettings().setJavaScriptEnabled(true);
    streamView.setWebViewClient(new StreamClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView v, String url) {
            return false;
        }
    });
    streamView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    streamView.getSettings().setLoadsImagesAutomatically(true);
    streamView.getSettings().setUseWideViewPort(true);
    streamView.getSettings().setLoadWithOverviewMode(true);
    String s = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0.1)";
    streamView.getSettings().setUserAgentString(s);
//      streamView.requestFocus(View.FOCUS_DOWN);
    streamView.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
//              switch (event.getAction()) {
//              case MotionEvent.ACTION_DOWN:
//              case MotionEvent.ACTION_UP:
//                  if (!v.hasFocus()) {
//                      v.requestFocus();
//                  }
//                  break;
//              }
            return false;
        }
    });
    streamView.loadUrl(url);

}

public void ChatClientSettings() {

    //chatView = new WebView(this);
//      chatView.setLayoutParams(new ViewGroup.LayoutParams(
//              LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    chatView.getSettings().setPluginState(PluginState.ON);
    chatView.getSettings().setJavaScriptEnabled(true);
    chatView.setWebViewClient(new StreamClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView v, String url) {
            return false;
        }
    });
    chatView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    chatView.getSettings().setLoadsImagesAutomatically(true);
    chatView.getSettings().setUseWideViewPort(true);
    chatView.getSettings().setLoadWithOverviewMode(true);
    String s = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0.1)";
    chatView.getSettings().setUserAgentString(s);
    chatView.requestFocus(View.FOCUS_DOWN);
    chatView.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_UP:
                if (!v.hasFocus()) {
                    v.requestFocus();
                }
                break;
            }
            return false;
        }
    });
    chatView.loadUrl(url2);

}

private void setStreamView() {

    if (flipView.getDisplayedChild() != 0) {
        flipView.setDisplayedChild(0);
        flipView.setInAnimation(slideRight);
        //flipView.setOutAnimation(slideLeft);
    }

}

private void setChatView() {

    if (flipView.getDisplayedChild() != 1) {
        flipView.setDisplayedChild(1);
        flipView.setInAnimation(slideLeft);
        //flipView.setOutAnimation(slideRight);
    }
}


@Override
public void onSwipe(int direction) {
    // TODO Auto-generated method stub

    switch (direction) {

    case SimpleGestureFilter.SWIPE_RIGHT:
        if (flipView.getDisplayedChild() == 0) {
            //flipView.setDisplayedChild(1);
            setChatView();
        }
        break;

    case SimpleGestureFilter.SWIPE_LEFT:
        if (flipView.getDisplayedChild() == 1) {
            //flipView.setDisplayedChild(0);
            setStreamView();
        }
        break;
    }
}
公共类WebViewPager扩展活动实现SimpleGetStereListener{
私人框架布局持有人;
私有网络视图;
私有网络视图;
私有视图Flipper flipView;
私人对话;
专用字符串url=”http://www.justin.tv/dbz_hd2/popout";
专用字符串url2=”http://www.justin.tv/chat/embed?channel=dbz_hd2";
专用SimpleGetStereFilter过滤器;
私人动画幻灯片;
私人动画幻灯片;
最终活动=此;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
//TODO自动生成的方法存根
super.onCreate(savedInstanceState);
setContentView(右布局、主布局);
holder=(FrameLayout)findviewbyd(R.id.streamViewHolder);
streamView=(WebView)findViewById(R.id.streamView);
StreamClientSettings();
flipView=(ViewFlipper)findViewById(R.id.mainFlipper);
flipView.setDisplayedChild(1);
this.filter=新的SimpleGestureFilter(this,this);
this.filter.setMode(SimpleGestureFilter.MODE_透明);
slideLeft=AnimationUtils.loadAnimation(this,R.anim.translate);
slideRight=AnimationUtils.loadAnimation(this,R.anim.translate);
新建ManageViews().execute();
}
私有类ManageView扩展了异步任务{
@凌驾
受保护的Void doInBackground(Void…args){
//TODO自动生成的方法存根
chatView=(WebView)findViewById(R.id.chatView);
ChatClientSettings();
返回null;
}
}
@凌驾
公共布尔dispatchTouchEvent(MotionEvent me){
this.filter.onTouchEvent(me);
返回super.dispatchTouchEvent(me);
}
public void StreamClientSettings(){
//streamView=新的网络视图(此);
//streamView.setLayoutParams(新的ViewGroup.LayoutParams(
//LayoutParams.MATCH_父级,LayoutParams.MATCH_父级);
streamView.getSettings().setPluginState(PluginState.ON);
streamView.getSettings().setJavaScriptEnabled(true);
setWebViewClient(新的StreamClient()){
@凌驾
公共布尔值shouldOverrideUrlLoading(WebView v,字符串url){
返回false;
}
});
streamView.setScrollBarStyle(视图.滚动条\u内部\u覆盖);
streamView.getSettings().setLoadsImagesAutomatically(true);
streamView.getSettings().setUseWideViewPort(true);
streamView.getSettings().SetLoadWithOverview模式(true);
字符串s=“Mozilla/5.0(Windows NT 6.1;WOW64;rv:8.0.1)”;
streamView.getSettings().setUserAgentString;
//streamView.requestFocus(View.FOCUS\u向下);
streamView.setOnTouchListener(新视图.OnTouchListener(){
@凌驾
公共布尔onTouch(视图v,运动事件){
//TODO自动生成的方法存根
//开关(event.getAction()){
//case MotionEvent.ACTION\u DOWN:
//case MotionEvent.ACTION\u UP:
//如果(!v.hasFocus()){
//v.请求焦点();
//                  }
//中断;
//              }
返回false;
}
});
loadUrl(url);
}
public void ChatClientSettings(){
//chatView=新的网络视图(此);
//chatView.setLayoutParams(新的ViewGroup.LayoutParams(
//LayoutParams.MATCH_父级,LayoutParams.MATCH_父级);
chatView.getSettings().setPluginState(PluginState.ON);
chatView.getSettings().setJavaScriptEnabled(true);
setWebViewClient(新的StreamClient()){
@凌驾
公共布尔值shouldOverrideUrlLoading(WebView v,字符串url){
返回false;
}
});
chatView.setScrollBarStyle(视图.滚动条\u内部\u覆盖);
chatView.getSettings().setLoadsImagesAutomatically(true);
chatView.getSettings().setUseWideViewPort(true);
chatView.getSettings().setLoadWithOverview模式(true);
字符串s=“Mozilla/5.0(Windows NT 6.1;WOW64;rv:8.0.1)”;
chatView.getSettings().setUserAgentString;
chatView.requestFocus(视图.焦点向下);
setOnTouchListener(新视图.OnTouchListener(){
@凌驾
公共布尔onTouch(视图v,运动事件){
//TODO自动生成的方法存根
开关(event.getAction()){
case MotionEvent.ACTION\u DOWN:
case MotionEvent.ACTION\u UP:
如果(!v.hasFocus()){
v、 requestFocus();
}
打破
}
返回false;
}
});
加载URL(url2);
}
私有void setStreamView(){
如果(flipView.getDisplayedChild()!=0){
flipView.setDisplayedChild(0);
flipView.setInAnimation(幻灯片右键);
//flipView.setOutAnimation(slideLeft);
}
}
私有void setChatView(){
如果(flipView.getDisplayedChild()!=1){
flipView.setDisplayedChild(1);
flipView.setInAnimation(slideLeft);
//flipView.setOutAnimation(slideRight);
}
}
@凌驾
公共空间(内部方向){
//TODO自动生成的方法存根
开关(方向){
case SimpleGestureFilter.swip_RIGHT:
如果(flipView.getDisplayedChild()==0){
//flipView.setDisplayedChild(1);
setChatView();
}
打破
case SimpleGestureFilter.swip_LEFT:
如果(flipView.getDisplayedChild()==1){
//flipView.setDisplayedChild(0);
setStreamView();
}
打破
}
}
我的布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

<ViewFlipper
    android:id="@+id/mainFlipper"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <FrameLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/streamViewHolder"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@null" >

        <WebView
            android:id="@+id/streamView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
    </FrameLayout>

    <WebView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/chatView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
</ViewFlipper>

</LinearLayout>

    @Override
public void onSwipe(int direction) {
    // TODO Auto-generated method stub

    switch (direction) {

    case SimpleGestureFilter.SWIPE_RIGHT:
        if (flipView.getDisplayedChild() == 1) {
            //flipView.setDisplayedChild(1);
            setStreamView();
            holder.addView(streamView);
        }
        break;

    case SimpleGestureFilter.SWIPE_LEFT:
        if (flipView.getDisplayedChild() == 0) {
            //flipView.setDisplayedChild(0);
            setChatView();
            holder.removeAllViews();
        }
        break;
    }