zoukankan      html  css  js  c++  java
  • 小问题记录

    1. 当一个ViewGroup中有两个 SurfaceVeiw 时,如surfaceView1, surfaceView2, 要 使sufaceView1 全部显示在下面,  而 surfaceView2 以透明的方式 覆盖在surfaceView1 之上, 如下设置,

    surfaceView1.setZOrderOnTop(false);  

    surfaceView2.setZOrderMediaOverlay(true);

    surfaceView2.getHolder().setFormat(PixelFormat.TRANSPARENT);

     2.实现Parcelable接口时,成员变量boolean类型的实现:

    public boolean isSelected;
    
    public void writeToParcel(Parcel out, int flags) {       
       out.writeByte((byte) (isSelected ? 1 : 0)); } private LyrPointEntity(Parcel in) { isSelected = in.readByte() != 0; }

    3.当在Fragment里面添加Viewpager,Viewpager由多个Fragment组成,在viewpager的setAdapter时产生错误如下:Recursive entry to executePendingTransactions。

    public class FrgtPagerAdapter extends FragmentPagerAdapter {
        private ArrayList<Fragment> fragments;
    
        public FrgtPagerAdapter(Fragment fragment, ArrayList<Fragment> fragments) {
            super(fragment.getChildFragmentManager());
            this.fragments = fragments;
        }

    于我而言,之前在构造方法里,super()参数是activity.getSupportFragmentManager(),如上,将其改为
    getChildFragmentManager()即可。

    http://stackoverflow.com/questions/7338823/viewpager-recursive-entry-to-executependingtransactions

    4. 下列方法分两个阶段关闭 ExecutorService。第一阶段调用 shutdown 拒绝传入任务,然后等60秒后,任务还没执行完成,就调用 shutdownNow(如有必要)取消所有遗留的任务

     void shutdownAndAwaitTermination(ExecutorService pool) {
       pool.shutdown(); // Disable new tasks from being submitted
       try {
         // Wait a while for existing tasks to terminate
         if (!pool.awaitTermination(60, TimeUnit.SECONDS)) {
           pool.shutdownNow(); // Cancel currently executing tasks
           // Wait a while for tasks to respond to being cancelled
           if (!pool.awaitTermination(60, TimeUnit.SECONDS))
               System.err.println("Pool did not terminate");
         }
       } catch (InterruptedException ie) {
         // (Re-)Cancel if current thread also interrupted
         pool.shutdownNow();
         // Preserve interrupt status
         Thread.currentThread().interrupt();
       }
     }
  • 相关阅读:
    ...
    抛砖引玉,说平台概念
    杂想
    相机镜头简易擦拭篇
    优秀软件体验2
    牛人就在我的身边
    对魔时网做了一下了解
    来了兴致,试试django吧,呵呵
    SD2.0大会
    从《首届中国优秀软件创新大赛 寻找中国软件新星 》预测互联网的未来趋势
  • 原文地址:https://www.cnblogs.com/oakpip/p/3666488.html
Copyright © 2011-2022 走看看