android custom viewgroups 性能分析

原文地址:https://sriramramani.wordpress.com/2015/05/06/custom-viewgroups/

Android provides a few ViewGroups like LinearLayout, RelativeLayout, FrameLayout to position child Views. These general purpose ViewGroups have quite a lot of options in them. For e.g, LinearLayout supports almost all (except for wrapping) features of HTML Flexbox. It also has options to show dividers in between Views, and measure all children based on the largest child. RelativeLayout works as a constraint solver. These layouts are good enough to start with. But do they perform well when your app has complex UI?

ViewGroup with a ProfilePhoto, Title, Subtitle and Menu button.

The above layout is pretty common in the Facebook app. A profile photo, a bunch of Views stacked vertically to its right, and an optional view on the far right. Using vanilla ViewGroups, this layout can be achieved using a LinearLayout of LinearLayouts or a RelativeLayout. Let’s take a look at the measure calls happening for these two layouts.

Here’s an example LinearLayout of LinearLayout file.

    

        

        

            

            <Subtitle
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

        </LinearLayout>

        <Menu
            android:layout_width="20dp"
            android:layout_height="20dp"/>

    </LinearLayout>
</pre> 
  <p>And the measure pass happens as follows on a Nexus 5.</p> 
  <pre><code class="language-plain">    > LinearLayout [horizontal]       [w: 1080  exactly,       h: 1557  exactly    ]
        > ProfilePhoto                [w: 120   exactly,       h: 120   exactly    ]
        > LinearLayout [vertical]     [w: 0     unspecified,   h: 0     unspecified]
            > Title                   [w: 0     unspecified,   h: 0     unspecified]
            > Subtitle                [w: 0     unspecified,   h: 0     unspecified]
            > Title                   [w: 222   exactly,       h: 57    exactly    ]
            > Subtitle                [w: 222   exactly,       h: 57    exactly    ]
        > Menu                        [w: 60    exactly,       h: 60    exactly    ]
        > LinearLayout [vertical]     [w: 900   exactly,       h: 1557  at_most    ]
            > Title                   [w: 900   exactly,       h: 1557  at_most    ]
            > Subtitle                [w: 900   exactly,       h: 1500  at_most    ]
</code></pre> 
  <p>The ProfilePhoto and the Menu are measured only once as they have an absolute width and height specified. The vertical LinearLayout gets measured twice here. During the first time, the parent LinearLayout asks it to measure with an UNSPECIFIED spec. This cause the vertical LinearLayout to measure its children with UNSPECIFIED spec. And then it measures its children with EXACTLY spec based on what they returned. But it doesn’t end there. Once after measuring the ProfilePhoto and the Menu, the parent knows the exact size available for the vertical LinearLayout. This causes the second pass where the Title and Subtitle are measured with an AT_MOST height. Clearly, every TextView (Title and Subtitle) is measured thrice. These are expensive operations as Layouts are created and thrown away during the second pass. If we want a better performing ViewGroup, cutting down the measure passes on the TextViews is the first thing to do.</p> 
  <p>Does a RelativeLayout work better here?</p> 
  <pre class="brush: xml; title: ; notranslate">    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    
        <ProfilePhoto
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"/>
    
        <Menu
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"/>

        <Title
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/profile_photo"
            android:layout_toLeftOf="@id/menu"/>
    
        <Subtitle
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/title"
            android:layout_toRightOf="@id/profile_photo"
            android:layout_toLeftOf="@id/menu"/>

    </RelativeLayout>
</pre> 
  <p>And the measure pass looks like this.</p> 
  <pre><code class="language-plain">    > RelativeLayout                  [w: 1080  exactly,   h: 1557  exactly]
        > Menu                        [w: 60    exactly,   h: 1557  at_most]
        > ProfilePhoto                [w: 120   exactly,   h: 1557  at_most]
        > Title                       [w: 900   exactly,   h: 1557  at_most]
        > Subtitle                    [w: 900   exactly,   h: 1557  at_most]
        > Title                       [w: 900   exactly,   h: 1557  at_most]
        > Subtitle                    [w: 900   exactly,   h: 1500  at_most]
        > Menu                        [w: 60    exactly,   h: 60    exactly]
        > ProfilePhoto                [w: 120   exactly,   h: 120   exactly]
</code></pre> 
  <p>As I previously mentioned, RelativeLayout measures by solving constraints. In the above layout, ProfilePhoto and the Menu are not dependent on any other siblings, and hence they are measured first (with an AT_MOST height). Then the Title (2 constraints) and Subtitle (3 constraints) are measured. At this point all Views know how much size they want. RelativeLayout uses this information for a second pass to measure the Title, Subtitle, Menu and ProfilePhoto. Again, every View is measured twice, thus being sub-optimal. If you compare this with LinearLayout example above, the last MeasureSpec used on all the leaf Views are the same — thus providing the same output on the screen.</p> 
  <p>How can we cut down the measure pass happening on the child Views? Do creating a custom ViewGroup help here? Let’s analyze the layout. The Title and Subtitle are always to the left of the ProfilePhoto and the right of the Menu button. The ProfilePhoto and the Menu button have fixed width and height. If we solve this manually, we need to calculate the size of the ProfilePhoto and the Menu button, and use the remaining size to calculate the Title and the Subtitle — thus performing only one measure pass on each View. Let’s call this layout ProfilePhotoLayout.</p> 
  <pre><code class="language-java">    public class ProfilePhotoLayout extends ViewGroup {

        private ProfilePhoto mProfilePhoto;
        private Menu mMenu;
        private Title mTitle;
        private Subtitle mSubtitle;

        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            // 1. Setup initial constraints.
            int widthConstraints = getPaddingLeft() + getPaddingRight();
            int heightContraints = getPaddingTop() + getPaddingBottom();
            int width = 0;
            int height = 0;
    
            // 2. Measure the ProfilePhoto
            measureChildWithMargins(
                mProfilePhoto,
                widthMeasureSpec,
                widthConstraints,
                heightMeasureSpec,
                heightConstraints);

            // 3. Update the contraints.
            widthConstraints += mProfilePhoto.getMeasuredWidth();
            width += mProfilePhoto.getMeasuredWidth();
            height = Math.max(mProfilePhoto.getMeasuredHeight(), height);

            // 4. Measure the Menu.
            measureChildWithMargins(
                mMenu,
                widthMeasureSpec,
                widthConstraints,
                heightMeasureSpec,
                heightConstraints);

            // 5. Update the constraints.
            widthConstraints += mMenu.getMeasuredWidth();
            width += mMenu.getMeasuredWidth();
            height = Math.max(mMenu.getMeasuredHeight(), height);

            // 6. Prepare the vertical MeasureSpec.
            int verticalWidthMeasureSpec = MeasureSpec.makeMeasureSpec(
                MeasureSpec.getSize(widthMeasureSpec) - widthConstraints,
                MeasureSpec.getMode(widthMeasureSpec));

            int verticalHeightMeasureSpec = MeasureSpec.makeMeasureSpec(
                MeasureSpec.getSize(heightMeasureSpec) - heightConstraints,
                MeasureSpec.getMode(heightMeasureSpec));

            // 7. Measure the Title.
            measureChildWithMargins(
                mTitle,
                verticalWidthMeasureSpec,
                0,
                verticalHeightMeasureSpec,
                0);

            // 8. Measure the Subtitle.
            measureChildWithMargins(
                mSubtitle,
                verticalWidthMeasureSpec,
                0,
                verticalHeightMeasureSpec,
                mTitle.getMeasuredHeight());

            // 9. Update the sizes.
            width += Math.max(mTitle.getMeasuredWidth(), mSubtitle.getMeasuredWidth());
            height = Math.max(mTitle.getMeasuredHeight() + mSubtitle.getMeasuredHeight(), height);

            // 10. Set the dimension for this ViewGroup.
            setMeasuredDimension(
                resolveSize(width, widthMeasureSpec),
                resolveSize(height, heightMeasureSpec));
        }

        @Override
        protected void measureChildWithMargins(
            View child,
            int parentWidthMeasureSpec,
            int widthUsed,
            int parentHeightMeasureSpec,
            int heightUsed) {
            MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();

            int childWidthMeasureSpec = getChildMeasureSpec(
                parentWidthMeasureSpec,
                widthUsed + lp.leftMargin + lp.rightMargin,
                lp.width);

            int childHeightMeasureSpec = getChildMeasureSpec(
                parentHeightMeasureSpec,
                heightUsed + lp.topMargin + lp.bottomMargin,
                lp.height);

            child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
        }
    }
</code></pre> 
  <p>Let’s analyze this code. We start with the known constraints — padding on all sides. The other way to look at constraints is that this value provides the amount of a dimension — width/height — used currently. Android provides a helper method, <code>measureChildWithMargins()</code> to measure a child inside a ViewGroup. However, it always adds padding to it as a part of constraints. Hence we have to override it to manage the constraints ourselves. We start by measuring the ProfilePhoto. Once measured, we update the constraints. We do the same thing for the Menu. Now this leaves us with the amount of width available for the Title and the Subtitle. Android provides another helper method, <code>makeMeasureSpec()</code>, to build a MeasureSpec. We pass in the required size and mode, and it returns a MeasureSpec. In this case, we pass in the available width and height for the Title and Subtitle. With these MeasureSpecs, we measure the Title and Subtitle. At the end we update the dimension for this ViewGroup. From the steps it’s clear that each View is measured only once.</p> 
  <pre><code class="language-plain">    > ProfilePhotoLayout              [w: 1080  exactly,   h: 1557  exactly]
        > ProfilePhoto                [w: 120   exactly,   h: 120   exactly]
        > Menu                        [w: 60    exactly,   h: 60    exactly]
        > Title                       [w: 900   exactly,   h: 1557  at_most]
        > Subtitle                    [w: 900   exactly,   h: 1500  at_most]
</code></pre> 
  <p>Does it really provide performance wins? Most of the layout you see in Facebook app uses this layout, and has proved to be really effective. And, I leave the <code>onLayout()</code> as an exercise for the reader <span class="wp-smiley wp-emoji wp-emoji-wink"> ;)</span></p> 
 </div> 
</div>
                            </div>
                        </div>
                    </div>
                    <!--PC和WAP自适应版-->
                    <div id="SOHUCS" sid="1298515153414856704"></div>
                    <script type="text/javascript" src="/views/front/js/chanyan.js"></script>
                    <!-- 文章页-底部 动态广告位 -->
                    <div class="youdao-fixed-ad" id="detail_ad_bottom"></div>
                </div>
                <div class="col-md-3">
                    <div class="row" id="ad">
                        <!-- 文章页-右侧1 动态广告位 -->
                        <div id="right-1" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad">
                            <div class="youdao-fixed-ad" id="detail_ad_1"> </div>
                        </div>
                        <!-- 文章页-右侧2 动态广告位 -->
                        <div id="right-2" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad">
                            <div class="youdao-fixed-ad" id="detail_ad_2"></div>
                        </div>
                        <!-- 文章页-右侧3 动态广告位 -->
                        <div id="right-3" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad">
                            <div class="youdao-fixed-ad" id="detail_ad_3"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="container">
        <h4 class="pt20 mb15 mt0 border-top">你可能感兴趣的:(Android)</h4>
        <div id="paradigm-article-related">
            <div class="recommend-post mb30">
                <ul class="widget-links">
                    <li><a href="/article/1835513699826233344.htm"
                           title="android系统selinux中添加新属性property" target="_blank">android系统selinux中添加新属性property</a>
                        <span class="text-muted">辉色投像</span>

                        <div>1.定位/android/system/sepolicy/private/property_contexts声明属性开头:persist.charge声明属性类型:u:object_r:system_prop:s0图12.定位到android/system/sepolicy/public/domain.te删除neverallow{domain-init}default_prop:property</div>
                    </li>
                    <li><a href="/article/1835470119195734016.htm"
                           title="2.2.6 通知类控件 Toast、Menu" target="_blank">2.2.6 通知类控件 Toast、Menu</a>
                        <span class="text-muted">常思行</span>

                        <div>本文例程下载:WillFlow_Toast、WillFlowMenu一、什么是Toast?Toast也被叫做吐司,是Android系统提供的一种非常好的提醒方式,在程序中可以使用它将一些短小的信息通知给用户,它有如下两个特点:Toast是没有焦点的Toast显示的时间有限过一定的时间就会自动消失所以一般来讲Toast的使用并不会影响我们的正常操作,并且它通常不会占用太大的屏幕空间,有着良好的用户体</div>
                    </li>
                    <li><a href="/article/1835450889452744704.htm"
                           title="mac 备份android 手机通讯录导入iphone,iphone如何导出通讯录(轻松教你iPhone备份通讯录的方法)..." target="_blank">mac 备份android 手机通讯录导入iphone,iphone如何导出通讯录(轻松教你iPhone备份通讯录的方法)...</a>
                        <span class="text-muted">weixin_39762838</span>
<a class="tag" taget="_blank" href="/search/mac/1.htm">mac</a><a class="tag" taget="_blank" href="/search/%E5%A4%87%E4%BB%BDandroid/1.htm">备份android</a><a class="tag" taget="_blank" href="/search/%E6%89%8B%E6%9C%BA%E9%80%9A%E8%AE%AF%E5%BD%95%E5%AF%BC%E5%85%A5iphone/1.htm">手机通讯录导入iphone</a>
                        <div>在日新月异的手机更替中,换手机已经成为一个非常稀松平常的事情,但将旧手机上面的通讯录导入到新手机还是让不少小伙伴为难,本篇将给大家详细讲解这方面的知识:“苹果手机通讯录怎么导入到新手机”及“安卓手机通讯录导入到新手机”的方法。一、苹果手机通讯录导入到新手机常用方法(SIM卡导入)在苹果手机主频幕上找到“设置”,单击进入设置菜单,下拉菜单列表,点击“邮件、通讯录、日历”,然后找到“导入SIM卡通讯录</div>
                    </li>
                    <li><a href="/article/1835450511071997952.htm"
                           title="android 更改窗口的层次,浮窗开发之窗口层级" target="_blank">android 更改窗口的层次,浮窗开发之窗口层级</a>
                        <span class="text-muted">Ms.Bu</span>
<a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/%E6%9B%B4%E6%94%B9%E7%AA%97%E5%8F%A3%E7%9A%84%E5%B1%82%E6%AC%A1/1.htm">更改窗口的层次</a>
                        <div>最近在项目中遇到了这样的需求:需要在特定的其他应用之上悬浮自己的UI交互(拖动、输入等复杂的UI交互),和九游的浮窗类似,不过我们的比九游的体验更好,我们越过了很多授权的限制。浮窗效果很多人都知道如何去实现一个简单的浮窗,但是却很少有人去深入的研究背后的流程机制,由于项目中浮窗交互比较复杂,遇到了些坑查看了很多资料,故总结浮窗涉及到的知识点:窗口层级关系(浮窗是如何“浮”的)?浮窗有哪些限制,如何</div>
                    </li>
                    <li><a href="/article/1835448619277316096.htm"
                           title="Android应用性能优化" target="_blank">Android应用性能优化</a>
                        <span class="text-muted">轻口味</span>
<a class="tag" taget="_blank" href="/search/Android/1.htm">Android</a>
                        <div>Android手机由于其本身的后台机制和硬件特点,性能上一直被诟病,所以软件开发者对软件本身的性能优化就显得尤为重要;本文将对Android开发过程中性能优化的各个方面做一个回顾与总结。Cache优化ListView缓存:ListView中有一个回收器,Item滑出界面的时候View会回收到这里,需要显示新的Item的时候,就尽量重用回收器里面的View;每次在getView函数中inflate新</div>
                    </li>
                    <li><a href="/article/1835412764722556928.htm"
                           title="Android实现监听事件的方法" target="_blank">Android实现监听事件的方法</a>
                        <span class="text-muted">Amy木婉清</span>

                        <div>1.通过内部类实现2.通过匿名内部类实现3.通过事件源所在类实现4.通过外部类实现5.布局文件中onclick属性(针对点击事件)1.通过内部类实现代码:privateButtonmBtnEvent;//oncreate中mBtnEvent.setOnClickListener(newOnClick());//内部类实现监听classOnClickimplementsView.OnClickLis</div>
                    </li>
                    <li><a href="/article/1835400203130204160.htm"
                           title="高级UI<第二十四篇>:Android中用到的矩阵常识" target="_blank">高级UI<第二十四篇>:Android中用到的矩阵常识</a>
                        <span class="text-muted">NoBugException</span>

                        <div>(1)定义在数学中,矩阵(Matrix)是一个按照长方阵列排列的复数或实数集合。由m×n个数aij排成的m行n列的数表称为m行n列的矩阵,简称m×n矩阵。记作:图片.png这m×n个数称为矩阵A的元素,简称为元,数aij位于矩阵A的第i行第j列,称为矩阵A的(i,j)元,以数aij为(i,j)元的矩阵可记为(aij)或(aij)m×n,m×n矩阵A也记作Amn。元素是实数的矩阵称为实矩阵,元素是复</div>
                    </li>
                    <li><a href="/article/1835398694636187648.htm"
                           title="RK3229_Android9.0_Box 4G模块EC200A调试" target="_blank">RK3229_Android9.0_Box 4G模块EC200A调试</a>
                        <span class="text-muted">suifen_</span>
<a class="tag" taget="_blank" href="/search/%E7%BD%91%E7%BB%9C/1.htm">网络</a>
                        <div>0、kernel修改这部分完全可以参考Linux的移植:RK3588EC200A-CN【4G模块】调试_rkec200a-cn-CSDN博客1、修改device/rockchip/rk322xdiff--gita/device.mkb/device.mkindexec6bfaa..e7c32d1100755---a/device.mk+++b/device.mk@@-105,6+105,8@@en</div>
                    </li>
                    <li><a href="/article/1835374864970641408.htm"
                           title="kt文件和java文件_Java与Kotlin之间怎样进行互操作" target="_blank">kt文件和java文件_Java与Kotlin之间怎样进行互操作</a>
                        <span class="text-muted">铭空间</span>
<a class="tag" taget="_blank" href="/search/kt%E6%96%87%E4%BB%B6%E5%92%8Cjava%E6%96%87%E4%BB%B6/1.htm">kt文件和java文件</a>
                        <div>Java与Kotlin之间怎样进行互操作发布时间:2021-02-0210:50:43来源:亿速云阅读:98作者:小新这篇文章主要介绍了Java与Kotlin之间怎样进行互操作,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。前言目前kotlin是谷歌首推的开发Android的语言,但由于历史原因,我们绝大部分项目依旧还是以Java为主</div>
                    </li>
                    <li><a href="/article/1835369316342657024.htm"
                           title="Android shell 常用 debug 命令" target="_blank">Android shell 常用 debug 命令</a>
                        <span class="text-muted">晨春计</span>
<a class="tag" taget="_blank" href="/search/Audio/1.htm">Audio</a><a class="tag" taget="_blank" href="/search/debug/1.htm">debug</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a>
                        <div>目录1、查看版本2、am命令3、pm命令4、dumpsys命令5、sed命令6、log定位查看APK进程号7、log定位使用场景1、查看版本1.1、Android串口终端执行getpropro.build.version.release#获取Android版本uname-a#查看linux内核版本信息uname-r#单独查看内核版本1.2、linux服务器执行lsb_release-a#查看Lin</div>
                    </li>
                    <li><a href="/article/1835332133149831168.htm"
                           title="2024年最全Flutter如何和Native通信-Android视角,Electron开发Android界面" target="_blank">2024年最全Flutter如何和Native通信-Android视角,Electron开发Android界面</a>
                        <span class="text-muted">2401_84544531</span>
<a class="tag" taget="_blank" href="/search/%E7%A8%8B%E5%BA%8F%E5%91%98/1.htm">程序员</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/%E9%9D%A2%E8%AF%95/1.htm">面试</a><a class="tag" taget="_blank" href="/search/%E5%AD%A6%E4%B9%A0/1.htm">学习</a>
                        <div>总结【Android详细知识点思维脑图(技能树)】其实Android开发的知识点就那么多,面试问来问去还是那么点东西。所以面试没有其他的诀窍,只看你对这些知识点准备的充分程度。so,出去面试时先看看自己复习到了哪个阶段就好。虽然Android没有前几年火热了,已经过去了会四大组件就能找到高薪职位的时代了。这只能说明Android中级以下的岗位饱和了,现在高级工程师还是比较缺少的,很多高级职位给的薪</div>
                    </li>
                    <li><a href="/article/1835288964056051712.htm"
                           title="分享一个基于python的电子书数据采集与可视化分析 hadoop电子书数据分析与推荐系统 spark大数据毕设项目(源码、调试、LW、开题、PPT)" target="_blank">分享一个基于python的电子书数据采集与可视化分析 hadoop电子书数据分析与推荐系统 spark大数据毕设项目(源码、调试、LW、开题、PPT)</a>
                        <span class="text-muted">计算机源码社</span>
<a class="tag" taget="_blank" href="/search/Python%E9%A1%B9%E7%9B%AE/1.htm">Python项目</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%95%B0%E6%8D%AE/1.htm">大数据</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%95%B0%E6%8D%AE/1.htm">大数据</a><a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/hadoop/1.htm">hadoop</a><a class="tag" taget="_blank" href="/search/%E8%AE%A1%E7%AE%97%E6%9C%BA%E6%AF%95%E4%B8%9A%E8%AE%BE%E8%AE%A1%E9%80%89%E9%A2%98/1.htm">计算机毕业设计选题</a><a class="tag" taget="_blank" href="/search/%E8%AE%A1%E7%AE%97%E6%9C%BA%E6%AF%95%E4%B8%9A%E8%AE%BE%E8%AE%A1%E6%BA%90%E7%A0%81/1.htm">计算机毕业设计源码</a><a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90/1.htm">数据分析</a><a class="tag" taget="_blank" href="/search/spark%E6%AF%95%E8%AE%BE/1.htm">spark毕设</a>
                        <div>作者:计算机源码社个人简介:本人八年开发经验,擅长Java、Python、PHP、.NET、Node.js、Android、微信小程序、爬虫、大数据、机器学习等,大家有这一块的问题可以一起交流!学习资料、程序开发、技术解答、文档报告如需要源码,可以扫取文章下方二维码联系咨询Java项目微信小程序项目Android项目Python项目PHP项目ASP.NET项目Node.js项目选题推荐项目实战|p</div>
                    </li>
                    <li><a href="/article/1835230728099557376.htm"
                           title="android ndk 开发jni调用对象方法,数组参数" target="_blank">android ndk 开发jni调用对象方法,数组参数</a>
                        <span class="text-muted">wulongkou</span>
<a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E9%97%AE%E9%A2%98/1.htm">开发问题</a><a class="tag" taget="_blank" href="/search/%E5%AE%89%E5%8D%93%E7%9A%84%E4%BA%8B/1.htm">安卓的事</a><a class="tag" taget="_blank" href="/search/ndk/1.htm">ndk</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/studio/1.htm">studio</a><a class="tag" taget="_blank" href="/search/jni/1.htm">jni</a>
                        <div>一、JNI和NDK关系JNI是Java语言提供的Java和C/C++相互沟通的机制,Java可以通过JNI调用本地的C/C++代码,本地的C/C++的代码也可以调用java代码。JNI是本地编程接口,Java和C/C++互相通过的接口。Java通过C/C++使用本地的代码的一个关键性原因在于C/C++代码的高效性。NDK是一系列工具的集合。它提供了一系列的工具,帮助开发者快速开发C(或C++)的动</div>
                    </li>
                    <li><a href="/article/1835224173648113664.htm"
                           title="Android jni中数组参数的传递方式" target="_blank">Android jni中数组参数的传递方式</a>
                        <span class="text-muted">lokeyme</span>
<a class="tag" taget="_blank" href="/search/Andriod/1.htm">Andriod</a><a class="tag" taget="_blank" href="/search/android%E5%BC%80%E5%8F%91/1.htm">android开发</a><a class="tag" taget="_blank" href="/search/JNI/1.htm">JNI</a><a class="tag" taget="_blank" href="/search/NDK/1.htm">NDK</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/c%E8%AF%AD%E8%A8%80/1.htm">c语言</a>
                        <div>1、背景今天调试了一下Androidjni关于Java中调用C代码的程序,发现我的数组参数传递方式不对,导致值传递不正确,我的方法是:C代码,入口函数#include#includejintJava_sony_MedicalRecordDemo_MainActivity_decryptionSuccess(JNIEnv*env,jobjectthiz,jintAttr[]){returnAttr[</div>
                    </li>
                    <li><a href="/article/1835197073578881024.htm"
                           title="1-1.Jetpack 之 Navigation 简单编码模板" target="_blank">1-1.Jetpack 之 Navigation 简单编码模板</a>
                        <span class="text-muted">我命由我12345</span>
<a class="tag" taget="_blank" href="/search/Android/1.htm">Android</a><a class="tag" taget="_blank" href="/search/-/1.htm">-</a><a class="tag" taget="_blank" href="/search/Jetpack/1.htm">Jetpack</a><a class="tag" taget="_blank" href="/search/%E7%AE%80%E5%8C%96%E7%BC%96%E7%A8%8B/1.htm">简化编程</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/java-ee/1.htm">java-ee</a><a class="tag" taget="_blank" href="/search/android-studio/1.htm">android-studio</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/studio/1.htm">studio</a><a class="tag" taget="_blank" href="/search/%E5%AE%89%E5%8D%93/1.htm">安卓</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/jetpack/1.htm">jetpack</a>
                        <div>一、Navigation1、Navigation概述Navigation是Jetpack中的一个重要成员,它主要是结合导航图(NavigationGraph)来控制和简化Fragment之间的导航,即往哪里走,该怎么走2、Navigate引入在模块级build.gradle中引入相关依赖implementation'androidx.navigation:navigation-fragment:2</div>
                    </li>
                    <li><a href="/article/1835139546212298752.htm"
                           title="Android JetPack架构——结合记事本Demo一篇打通对Sqlite的增删改查结合常用jetpack架构应用" target="_blank">Android JetPack架构——结合记事本Demo一篇打通对Sqlite的增删改查结合常用jetpack架构应用</a>
                        <span class="text-muted">erhtre</span>
<a class="tag" taget="_blank" href="/search/%E7%A8%8B%E5%BA%8F%E5%91%98/1.htm">程序员</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/jetpack/1.htm">jetpack</a><a class="tag" taget="_blank" href="/search/%E6%9E%B6%E6%9E%84/1.htm">架构</a><a class="tag" taget="_blank" href="/search/sqlite/1.htm">sqlite</a>
                        <div>为什么要用Jetpack?========================================================================关于为什么要用Jetpack,我参考了许多的博客和官方文档,开阔了我对Android生态圈的理解和认识,在Jetpack推出前出现的许许多多强大的第三方框架与语言,典型代表无疑是强大的RxJava在Jetpack仍然有许多粉丝在一</div>
                    </li>
                    <li><a href="/article/1835139294000410624.htm"
                           title="Android干净架构MVI模板使用指南" target="_blank">Android干净架构MVI模板使用指南</a>
                        <span class="text-muted">井美婵Toby</span>

                        <div>Android干净架构MVI模板使用指南android-clean-architecture-mvi-boilerplateAforkofourcleanarchitectureboilerplateusingtheModel-View-Intentpattern项目地址:https://gitcode.com/gh_mirrors/an/android-clean-architecture-mv</div>
                    </li>
                    <li><a href="/article/1835136270758670336.htm"
                           title="⭐Unity 安卓环境中正确地读取和处理 XML 文件" target="_blank">⭐Unity 安卓环境中正确地读取和处理 XML 文件</a>
                        <span class="text-muted">惊鸿醉</span>
<a class="tag" taget="_blank" href="/search/Unity/1.htm">Unity</a><a class="tag" taget="_blank" href="/search/unity/1.htm">unity</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/xml/1.htm">xml</a>
                        <div>写了一个选择题Demo,电脑包和编辑器内无问题,但是打包安卓手机之后题目无法正常使用,想到的是安卓环境中正确地读取文件的问题改进方案:1.由于XmlDocument.Load方法在Android上的路径问题(由于文件位于APK内部,无法像在文件系统中那样直接访问),需要先使用UnityWebRequest来异步加载文件内容,然后再解析XML。2.异步处理:修改你的代码,以支持异步文件加载和处理,这</div>
                    </li>
                    <li><a href="/article/1835128195632951296.htm"
                           title="《Android进阶之光》读书笔记" target="_blank">《Android进阶之光》读书笔记</a>
                        <span class="text-muted">soleil雪寂</span>
<a class="tag" taget="_blank" href="/search/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/1.htm">读书笔记</a><a class="tag" taget="_blank" href="/search/%23/1.htm">#</a><a class="tag" taget="_blank" href="/search/Android%E8%BF%9B%E9%98%B6%E4%B9%8B%E5%85%89/1.htm">Android进阶之光</a>
                        <div>文章目录第1章Android新特性1.1.Android5.0新特性1.2.RecyclerView1.1.4.3种Notification1.1.5.Toolbar与Palette1.1.6.Palette1.2.Android6.0新特性1.2.2.运行时权限机制1.3.Android7.0新特性第2章MaterialDesign2.2.DesignSupportLibrary常用控件详解第3</div>
                    </li>
                    <li><a href="/article/1835126172099375104.htm"
                           title="《Android进阶之光》— Android 书籍" target="_blank">《Android进阶之光》— Android 书籍</a>
                        <span class="text-muted">王睿丶</span>
<a class="tag" taget="_blank" href="/search/Android/1.htm">Android</a><a class="tag" taget="_blank" href="/search/%E6%B0%B8%E6%97%A0%E6%AD%A2%E5%A2%83/1.htm">永无止境</a><a class="tag" taget="_blank" href="/search/%E3%80%8AAndroid%E8%BF%9B%E9%98%B6%E4%B9%8B%E5%85%89%E3%80%8B/1.htm">《Android进阶之光》</a><a class="tag" taget="_blank" href="/search/Android%E4%B9%A6%E7%B1%8D/1.htm">Android书籍</a><a class="tag" taget="_blank" href="/search/Android/1.htm">Android</a><a class="tag" taget="_blank" href="/search/phoenix/1.htm">phoenix</a><a class="tag" taget="_blank" href="/search/%E7%A7%BB%E5%8A%A8%E5%BC%80%E5%8F%91/1.htm">移动开发</a>
                        <div>文章目录第1章Android新特性1第2章MaterialDesign48第3章View体系与自定义View87第4章多线程编程165第5章网络编程与网络框架204第6章设计模式271第7章事件总线308第8章函数响应式编程333第9章注解与依赖注入框架382第10章应用架构设计422第11章系统架构与MediaPlayer框架460出版年:2017-7简介:《Android进阶之光》是一本And</div>
                    </li>
                    <li><a href="/article/1835123902771195904.htm"
                           title="《android进阶之光》——多线程编程(上)" target="_blank">《android进阶之光》——多线程编程(上)</a>
                        <span class="text-muted">TAING要一直努力</span>
<a class="tag" taget="_blank" href="/search/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/1.htm">读书笔记</a>
                        <div>今天了解了下多线程编程,知识点如下:进程与线程:进程是什么?线程是什么?进程可以看作是程序的实体,是线程的容器,是受操作系统管理的基本运行单元,例如exe文件就是一个进程。线程是进程运行的一些子任务,是操作系统调度的最小单元,各线程拥有自己的计数器,堆栈,局部变量等,也可以访问线程间共享的内存。线程的状态有哪些?新创建,可运行,等待,超时等待,阻塞,终止怎么创建一个线程?-三种方法第一种,MyTr</div>
                    </li>
                    <li><a href="/article/1835118105613922304.htm"
                           title="android进阶之光!Android面试必备的集合源码详解,系列篇" target="_blank">android进阶之光!Android面试必备的集合源码详解,系列篇</a>
                        <span class="text-muted">程序员Sunbu</span>
<a class="tag" taget="_blank" href="/search/%E7%A8%8B%E5%BA%8F%E5%91%98/1.htm">程序员</a><a class="tag" taget="_blank" href="/search/Android/1.htm">Android</a>
                        <div>前言面试:如果不准备充分的面试,完全是浪费时间,更是对自己的不负责。文末会给大家分享下我整理的Android面试专题及答案其中大部分都是大企业面试常问的面试题,可以对照这查漏补缺,当然了,这里所列的肯定不可能覆盖全部方式,不过对大家找工作肯定是有帮助!本月飞机到达上海,到今天第6天了,四家大公司华为,小米,映客,抖音,还有二家中小型公司。有几家已经面了几轮,下周还要面,挂了几家,不过目前已经选择了</div>
                    </li>
                    <li><a href="/article/1835094160550490112.htm"
                           title="Android-悬浮窗功能的实现(附Java、KT实现源码)(1)" target="_blank">Android-悬浮窗功能的实现(附Java、KT实现源码)(1)</a>
                        <span class="text-muted">egrhef</span>
<a class="tag" taget="_blank" href="/search/%E7%A8%8B%E5%BA%8F%E5%91%98/1.htm">程序员</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a>
                        <div>//获取服务的操作对象valbinder=serviceasFloatWinfowServices.MyBinderbinder.service}overridefunonServiceDisconnected(name:ComponentName){}}overridefunonActivityResult(requestCode:Int,resultCode:Int,data:Intent){</div>
                    </li>
                    <li><a href="/article/1835061636268912640.htm"
                           title="Visual Studio中的Android模拟器使用详解" target="_blank">Visual Studio中的Android模拟器使用详解</a>
                        <span class="text-muted">wurui8</span>
<a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/studio/1.htm">studio</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/android%E5%BA%94%E7%94%A8/1.htm">android应用</a>
                        <div>关注微信号:javalearns随时随地学Java或扫一扫随时随地学JavaMicrosoft本周发布了VisualStudio2015预览版,里面包含Android开发工具.安装的时候,如果选Android开发,VisualStudio会把调试Android应用程序用的VisualStudio模拟器也装上.在介绍这个新模拟器之前,我们先来聊一聊,为什么需要一个新的Android模拟器–当然,你也</div>
                    </li>
                    <li><a href="/article/1835057219947819008.htm"
                           title="Unity 热更 之 【HybirdCLR】+【YooAsset】 [安卓 Android端] [代码 + 资源热更] 功能的 简单实现演示" target="_blank">Unity 热更 之 【HybirdCLR】+【YooAsset】 [安卓 Android端] [代码 + 资源热更] 功能的 简单实现演示</a>
                        <span class="text-muted">仙魁XAN</span>
<a class="tag" taget="_blank" href="/search/Unity/1.htm">Unity</a><a class="tag" taget="_blank" href="/search/%E8%BF%9B%E9%98%B6/1.htm">进阶</a><a class="tag" taget="_blank" href="/search/unity/1.htm">unity</a><a class="tag" taget="_blank" href="/search/HybirdCLR/1.htm">HybirdCLR</a><a class="tag" taget="_blank" href="/search/YooAsset/1.htm">YooAsset</a><a class="tag" taget="_blank" href="/search/HotUpdate/1.htm">HotUpdate</a><a class="tag" taget="_blank" href="/search/%E7%83%AD%E6%9B%B4%E6%96%B0/1.htm">热更新</a>
                        <div>Unity热更之【HybirdCLR】+【YooAsset】[安卓Android端][代码+资源热更]功能的简单实现演示目录Unity热更之【HybirdCLR】+【YooAsset】[安卓Android端][代码+资源热更]功能的简单实现演示一、简单介绍二、HybridCLR三、YooAsset四、HybirdCLR引入工程五、YooAsset引入工程六、Python服务器简单构建七、Hybir</div>
                    </li>
                    <li><a href="/article/1835053685592387584.htm"
                           title="Android 用线程池实现一个简单的任务队列(Kotlin)" target="_blank">Android 用线程池实现一个简单的任务队列(Kotlin)</a>
                        <span class="text-muted">深海呐</span>
<a class="tag" taget="_blank" href="/search/Android/1.htm">Android</a><a class="tag" taget="_blank" href="/search/%23/1.htm">#</a><a class="tag" taget="_blank" href="/search/Android%E8%BF%9B%E9%98%B6/1.htm">Android进阶</a><a class="tag" taget="_blank" href="/search/%23/1.htm">#</a><a class="tag" taget="_blank" href="/search/Kotlin/1.htm">Kotlin</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/kotlin/1.htm">kotlin</a><a class="tag" taget="_blank" href="/search/%E7%BA%BF%E7%A8%8B%E6%B1%A0/1.htm">线程池</a><a class="tag" taget="_blank" href="/search/%E5%BB%B6%E6%97%B6%E4%BB%BB%E5%8A%A1%E9%98%9F%E5%88%97/1.htm">延时任务队列</a><a class="tag" taget="_blank" href="/search/%E7%BA%BF%E7%A8%8B%E6%B1%A0%E5%BB%B6%E6%97%B6%E4%BB%BB%E5%8A%A1/1.htm">线程池延时任务</a>
                        <div>关于线程池,Kotlin和java的使用方式一样在Android中,很多人喜欢用Handler的postDelayed()去实现延时任务.要使用postDelayed(),去实现延时任务队列,就不可避免要使用递归.但是这样做,代码的简洁性,和书写的简易,就远不如使用线程池.使用线程池的简单程度:privatevalmThreadPool=Executors.newSingleThreadSched</div>
                    </li>
                    <li><a href="/article/1835053432449363968.htm"
                           title="(小白入门)Windows环境下搭建React Native Android开发环境" target="_blank">(小白入门)Windows环境下搭建React Native Android开发环境</a>
                        <span class="text-muted">码农老黑</span>
<a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a><a class="tag" taget="_blank" href="/search/React/1.htm">React</a><a class="tag" taget="_blank" href="/search/Native/1.htm">Native</a><a class="tag" taget="_blank" href="/search/%E7%A7%BB%E5%8A%A8%E5%BC%80%E5%8F%91/1.htm">移动开发</a><a class="tag" taget="_blank" href="/search/Android/1.htm">Android</a><a class="tag" taget="_blank" href="/search/studio/1.htm">studio</a>
                        <div>ReactNative(简称RN)是Facebook于2015年4月开源的跨平台移动应用开发框架,是Facebook早先开源的UI框架React在原生移动应用平台的衍生产物,目前支持iOS和Android两大平台。RN的环境搭建在RN的中文社区有所介绍,但是对于小白来说还是有些太过简略了。RN中文社区详见参考,本文不涉及的问题也许在其中能够有所解答。ReactNative思想底层引擎是JavaSc</div>
                    </li>
                    <li><a href="/article/1835051666974535680.htm"
                           title="Android Dialog圆角设置无效的问题" target="_blank">Android Dialog圆角设置无效的问题</a>
                        <span class="text-muted">ly969434341</span>
<a class="tag" taget="_blank" href="/search/android/1.htm">android</a>
                        <div>一,参考AndroidDialog圆角设置无效的问题https://blog.csdn.net/woshi_awei/article/details/99664527Android自定义Dialog实现通用圆角对话框https://cloud.tencent.com/developer/article/1740956二,原因Diallog的默认背景是白色(直角背景),我自定义的Dialog背景也是</div>
                    </li>
                    <li><a href="/article/1835050659297193984.htm"
                           title="MultiSnapRecyclerView:让Android RecyclerView的滚动停靠更灵活" target="_blank">MultiSnapRecyclerView:让Android RecyclerView的滚动停靠更灵活</a>
                        <span class="text-muted">技术无疆</span>
<a class="tag" taget="_blank" href="/search/Android/1.htm">Android</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/ui/1.htm">ui</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/studio/1.htm">studio</a><a class="tag" taget="_blank" href="/search/android-studio/1.htm">android-studio</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/androidx/1.htm">androidx</a>
                        <div>在Android应用开发中,RecyclerView是一个强大且灵活的组件,用于展示大量数据集合。然而,标准的RecyclerView只支持单一的滚动停靠点,这在某些场景下可能不够灵活。为了解决这个问题,TakuSemba开发了一个名为MultiSnapRecyclerView的库,它允许开发者在RecyclerView中实现多个滚动停靠点。文章目录什么是MultiSnapRecyclerView</div>
                    </li>
                    <li><a href="/article/1835050154282020864.htm"
                           title="Android界面特效全汇总" target="_blank">Android界面特效全汇总</a>
                        <span class="text-muted">小飞鹤</span>
<a class="tag" taget="_blank" href="/search/Android%E5%BC%80%E5%8F%91%E8%AF%A6%E8%A7%A3/1.htm">Android开发详解</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a>
                        <div>(一)Activity页面切换的效果Android2.0之后有了overridePendingTransition(),其中里面两个参数,一个是前一个activity的退出两一个activity的进入,Java代码1.@OverridepublicvoidonCreate(BundlesavedInstanceState){2.super.onCreate(savedInstanceState);</div>
                    </li>
                                <li><a href="/article/99.htm"
                                       title="ios内付费" target="_blank">ios内付费</a>
                                    <span class="text-muted">374016526</span>
<a class="tag" taget="_blank" href="/search/ios/1.htm">ios</a><a class="tag" taget="_blank" href="/search/%E5%86%85%E4%BB%98%E8%B4%B9/1.htm">内付费</a>
                                    <div>近年来写了很多IOS的程序,内付费也用到不少,使用IOS的内付费实现起来比较麻烦,这里我写了一个简单的内付费包,希望对大家有帮助。 
  
具体使用如下: 
这里的sender其实就是调用者,这里主要是为了回调使用。 
[KuroStoreApi kuroStoreProductId:@"产品ID" storeSender:self storeFinishCallBa</div>
                                </li>
                                <li><a href="/article/226.htm"
                                       title="20 款优秀的 Linux 终端仿真器" target="_blank">20 款优秀的 Linux 终端仿真器</a>
                                    <span class="text-muted">brotherlamp</span>
<a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/linux%E8%A7%86%E9%A2%91/1.htm">linux视频</a><a class="tag" taget="_blank" href="/search/linux%E8%B5%84%E6%96%99/1.htm">linux资料</a><a class="tag" taget="_blank" href="/search/linux%E8%87%AA%E5%AD%A6/1.htm">linux自学</a><a class="tag" taget="_blank" href="/search/linux%E6%95%99%E7%A8%8B/1.htm">linux教程</a>
                                    <div>  
终端仿真器是一款用其它显示架构重现可视终端的计算机程序。换句话说就是终端仿真器能使哑终端看似像一台连接上了服务器的客户机。终端仿真器允许最终用户用文本用户界面和命令行来访问控制台和应用程序。(LCTT 译注:终端仿真器原意指对大型机-哑终端方式的模拟,不过在当今的 Linux 环境中,常指通过远程或本地方式连接的伪终端,俗称“终端”。) 
你能从开源世界中找到大量的终端仿真器,它们</div>
                                </li>
                                <li><a href="/article/353.htm"
                                       title="Solr Deep Paging(solr 深分页)" target="_blank">Solr Deep Paging(solr 深分页)</a>
                                    <span class="text-muted">eksliang</span>
<a class="tag" taget="_blank" href="/search/solr%E6%B7%B1%E5%88%86%E9%A1%B5/1.htm">solr深分页</a><a class="tag" taget="_blank" href="/search/solr%E5%88%86%E9%A1%B5%E6%80%A7%E8%83%BD%E9%97%AE%E9%A2%98/1.htm">solr分页性能问题</a>
                                    <div>转载请出自出处:http://eksliang.iteye.com/blog/2148370 
作者:eksliang(ickes) blg:http://eksliang.iteye.com/ 概述 
长期以来,我们一直有一个深分页问题。如果直接跳到很靠后的页数,查询速度会比较慢。这是因为Solr的需要为查询从开始遍历所有数据。直到Solr的4.7这个问题一直没有一个很好的解决方案。直到solr</div>
                                </li>
                                <li><a href="/article/480.htm"
                                       title="数据库面试题" target="_blank">数据库面试题</a>
                                    <span class="text-muted">18289753290</span>
<a class="tag" taget="_blank" href="/search/%E9%9D%A2%E8%AF%95%E9%A2%98+%E6%95%B0%E6%8D%AE%E5%BA%93/1.htm">面试题 数据库</a>
                                    <div>1.union ,union all 
网络搜索出的最佳答案: 
union和union all的区别是,union会自动压缩多个结果集合中的重复结果,而union all则将所有的结果全部显示出来,不管是不是重复。 
Union:对两个结果集进行并集操作,不包括重复行,同时进行默认规则的排序; 
Union All:对两个结果集进行并集操作,包括重复行,不进行排序; 
2.索引有哪些分类?作用是</div>
                                </li>
                                <li><a href="/article/607.htm"
                                       title="Android TV屏幕适配" target="_blank">Android TV屏幕适配</a>
                                    <span class="text-muted">酷的飞上天空</span>
<a class="tag" taget="_blank" href="/search/android/1.htm">android</a>
                                    <div>先说下现在市面上TV分辨率的大概情况 
两种分辨率为主 
1.720标清,分辨率为1280x720. 
屏幕尺寸以32寸为主,部分电视为42寸 
2.1080p全高清,分辨率为1920x1080 
屏幕尺寸以42寸为主,此分辨率电视屏幕从32寸到50寸都有 
  
适配遇到问题,已1080p尺寸为例: 
分辨率固定不变,屏幕尺寸变化较大。 
如:效果图尺寸为1920x1080,如果使用d</div>
                                </li>
                                <li><a href="/article/734.htm"
                                       title="Timer定时器与ActionListener联合应用" target="_blank">Timer定时器与ActionListener联合应用</a>
                                    <span class="text-muted">永夜-极光</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a>
                                    <div>功能:在控制台每秒输出一次 
  
代码: 
package Main;
import javax.swing.Timer;
 import java.awt.event.*;

 public class T {
    private static int count = 0; 

    public static void main(String[] args){
</div>
                                </li>
                                <li><a href="/article/861.htm"
                                       title="Ubuntu14.04系统Tab键不能自动补全问题解决" target="_blank">Ubuntu14.04系统Tab键不能自动补全问题解决</a>
                                    <span class="text-muted">随便小屋</span>
<a class="tag" taget="_blank" href="/search/Ubuntu+14.04/1.htm">Ubuntu 14.04</a>
                                    <div>Unbuntu 14.4安装之后就在终端中使用Tab键不能自动补全,解决办法如下: 
  
1、利用vi编辑器打开/etc/bash.bashrc文件(需要root权限) 
sudo vi /etc/bash.bashrc 
 接下来会提示输入密码 
2、找到文件中的下列代码 
#enable bash completion in interactive shells
#if</div>
                                </li>
                                <li><a href="/article/988.htm"
                                       title="学会人际关系三招 轻松走职场" target="_blank">学会人际关系三招 轻松走职场</a>
                                    <span class="text-muted">aijuans</span>
<a class="tag" taget="_blank" href="/search/%E8%81%8C%E5%9C%BA/1.htm">职场</a>
                                    <div>要想成功,仅有专业能力是不够的,处理好与老板、同事及下属的人际关系也是门大学问。如何才能在职场如鱼得水、游刃有余呢?在此,教您简单实用的三个窍门。 
  第一,多汇报 
 最近,管理学又提出了一个新名词“追随力”。它告诉我们,做下属最关键的就是要多请示汇报,让上司随时了解你的工作进度,有了新想法也要及时建议。不知不觉,你就有了“追随力”,上司会越来越了解和信任你。 
  第二,勤沟通 
 团队的力</div>
                                </li>
                                <li><a href="/article/1115.htm"
                                       title="《O2O:移动互联网时代的商业革命》读书笔记" target="_blank">《O2O:移动互联网时代的商业革命》读书笔记</a>
                                    <span class="text-muted">aoyouzi</span>
<a class="tag" taget="_blank" href="/search/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/1.htm">读书笔记</a>
                                    <div>移动互联网的未来:碎片化内容+碎片化渠道=各式精准、互动的新型社会化营销。 
  
O2O:Online to OffLine 线上线下活动 
O2O就是在移动互联网时代,生活消费领域通过线上和线下互动的一种新型商业模式。 
  
手机二维码本质:O2O商务行为从线下现实世界到线上虚拟世界的入口。 
  
线上虚拟世界创造的本意是打破信息鸿沟,让不同地域、不同需求的人</div>
                                </li>
                                <li><a href="/article/1242.htm"
                                       title="js实现图片随鼠标滚动的效果" target="_blank">js实现图片随鼠标滚动的效果</a>
                                    <span class="text-muted">百合不是茶</span>
<a class="tag" taget="_blank" href="/search/JavaScript/1.htm">JavaScript</a><a class="tag" taget="_blank" href="/search/%E6%BB%9A%E5%8A%A8%E5%B1%9E%E6%80%A7%E7%9A%84%E8%8E%B7%E5%8F%96/1.htm">滚动属性的获取</a><a class="tag" taget="_blank" href="/search/%E5%9B%BE%E7%89%87%E6%BB%9A%E5%8A%A8/1.htm">图片滚动</a><a class="tag" taget="_blank" href="/search/%E5%B1%9E%E6%80%A7%E8%8E%B7%E5%8F%96/1.htm">属性获取</a><a class="tag" taget="_blank" href="/search/%E9%A1%B5%E9%9D%A2%E5%8A%A0%E8%BD%BD/1.htm">页面加载</a>
                                    <div>1,获取样式属性值 
top  与顶部的距离
left  与左边的距离
right 与右边的距离
bottom 与下边的距离
zIndex 层叠层次 
  
  例子:获取左边的宽度,当css写在body标签中时 
<div id="adver" style="position:absolute;top:50px;left:1000p</div>
                                </li>
                                <li><a href="/article/1369.htm"
                                       title="ajax同步异步参数async" target="_blank">ajax同步异步参数async</a>
                                    <span class="text-muted">bijian1013</span>
<a class="tag" taget="_blank" href="/search/jquery/1.htm">jquery</a><a class="tag" taget="_blank" href="/search/Ajax/1.htm">Ajax</a><a class="tag" taget="_blank" href="/search/async/1.htm">async</a>
                                    <div>        开发项目开发过程中,需要将ajax的返回值赋到全局变量中,然后在该页面其他地方引用,因为ajax异步的原因一直无法成功,需将async:false,使其变成同步的。 
        格式: 
$.ajax({ type: 'POST', ur</div>
                                </li>
                                <li><a href="/article/1496.htm"
                                       title="Webx3框架(1)" target="_blank">Webx3框架(1)</a>
                                    <span class="text-muted">Bill_chen</span>
<a class="tag" taget="_blank" href="/search/eclipse/1.htm">eclipse</a><a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a><a class="tag" taget="_blank" href="/search/maven/1.htm">maven</a><a class="tag" taget="_blank" href="/search/%E6%A1%86%E6%9E%B6/1.htm">框架</a><a class="tag" taget="_blank" href="/search/ibatis/1.htm">ibatis</a>
                                    <div>Webx是淘宝开发的一套Web开发框架,Webx3是其第三个升级版本;采用Eclipse的开发环境,现在支持java开发; 
采用turbine原型的MVC框架,扩展了Spring容器,利用Maven进行项目的构建管理,灵活的ibatis持久层支持,总的来说,还是一套很不错的Web框架。 
Webx3遵循turbine风格,velocity的模板被分为layout/screen/control三部</div>
                                </li>
                                <li><a href="/article/1623.htm"
                                       title="【MongoDB学习笔记五】MongoDB概述" target="_blank">【MongoDB学习笔记五】MongoDB概述</a>
                                    <span class="text-muted">bit1129</span>
<a class="tag" taget="_blank" href="/search/mongodb/1.htm">mongodb</a>
                                    <div>MongoDB是面向文档的NoSQL数据库,尽量业界还对MongoDB存在一些质疑的声音,比如性能尤其是查询性能、数据一致性的支持没有想象的那么好,但是MongoDB用户群确实已经够多。MongoDB的亮点不在于它的性能,而是它处理非结构化数据的能力以及内置对分布式的支持(复制、分片达到的高可用、高可伸缩),同时它提供的近似于SQL的查询能力,也是在做NoSQL技术选型时,考虑的一个重要因素。Mo</div>
                                </li>
                                <li><a href="/article/1750.htm"
                                       title="spring/hibernate/struts2常见异常总结" target="_blank">spring/hibernate/struts2常见异常总结</a>
                                    <span class="text-muted">白糖_</span>
<a class="tag" taget="_blank" href="/search/Hibernate/1.htm">Hibernate</a>
                                    <div> 
 Spring 
 
①ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException 
缺少aspectjweaver.jar,该jar包常用于spring aop中 
  
②java.lang.ClassNotFoundException: org.sprin</div>
                                </li>
                                <li><a href="/article/1877.htm"
                                       title="jquery easyui表单重置(reset)扩展思路" target="_blank">jquery easyui表单重置(reset)扩展思路</a>
                                    <span class="text-muted">bozch</span>
<a class="tag" taget="_blank" href="/search/form/1.htm">form</a><a class="tag" taget="_blank" href="/search/jquery+easyui/1.htm">jquery easyui</a><a class="tag" taget="_blank" href="/search/reset/1.htm">reset</a>
                                    <div>在jquery easyui表单中 尚未提供表单重置的功能,这就需要自己对其进行扩展。 
扩展的时候要考虑的控件有: 
 combo,combobox,combogrid,combotree,datebox,datetimebox 
需要对其添加reset方法,reset方法就是把初始化的值赋值给当前的组件,这就需要在组件的初始化时将值保存下来。 
在所有的reset方法添加完毕之后,就需要对fo</div>
                                </li>
                                <li><a href="/article/2004.htm"
                                       title="编程之美-烙饼排序" target="_blank">编程之美-烙饼排序</a>
                                    <span class="text-muted">bylijinnan</span>
<a class="tag" taget="_blank" href="/search/%E7%BC%96%E7%A8%8B%E4%B9%8B%E7%BE%8E/1.htm">编程之美</a>
                                    <div>
package beautyOfCoding;

import java.util.Arrays;

/*
 *《编程之美》的思路是:搜索+剪枝。有点像是写下棋程序:当前情况下,把所有可能的下一步都做一遍;在这每一遍操作里面,计算出如果按这一步走的话,能不能赢(得出最优结果)。
 *《编程之美》上代码有很多错误,且每个变量的含义令人费解。因此我按我的理解写了以下代码:
 */
</div>
                                </li>
                                <li><a href="/article/2131.htm"
                                       title="Struts1.X 源码分析之ActionForm赋值原理" target="_blank">Struts1.X 源码分析之ActionForm赋值原理</a>
                                    <span class="text-muted">chenbowen00</span>
<a class="tag" taget="_blank" href="/search/struts/1.htm">struts</a>
                                    <div>struts1在处理请求参数之前,首先会根据配置文件action节点的name属性创建对应的ActionForm。如果配置了name属性,却找不到对应的ActionForm类也不会报错,只是不会处理本次请求的请求参数。 
 
如果找到了对应的ActionForm类,则先判断是否已经存在ActionForm的实例,如果不存在则创建实例,并将其存放在对应的作用域中。作用域由配置文件action节点的s</div>
                                </li>
                                <li><a href="/article/2258.htm"
                                       title="[空天防御与经济]在获得充足的外部资源之前,太空投资需有限度" target="_blank">[空天防御与经济]在获得充足的外部资源之前,太空投资需有限度</a>
                                    <span class="text-muted">comsci</span>
<a class="tag" taget="_blank" href="/search/%E8%B5%84%E6%BA%90/1.htm">资源</a>
                                    <div> 
      这里有一个常识性的问题: 
 
      地球的资源,人类的资金是有限的,而太空是无限的..... 
 
      就算全人类联合起来,要在太空中修建大型空间站,也不一定能够成功,因为资源和资金,技术有客观的限制.... 
 
&</div>
                                </li>
                                <li><a href="/article/2385.htm"
                                       title="ORACLE临时表—ON COMMIT PRESERVE ROWS" target="_blank">ORACLE临时表—ON COMMIT PRESERVE ROWS</a>
                                    <span class="text-muted">daizj</span>
<a class="tag" taget="_blank" href="/search/oracle/1.htm">oracle</a><a class="tag" taget="_blank" href="/search/%E4%B8%B4%E6%97%B6%E8%A1%A8/1.htm">临时表</a>
                                    <div>ORACLE临时表 转 
临时表:像普通表一样,有结构,但是对数据的管理上不一样,临时表存储事务或会话的中间结果集,临时表中保存的数据只对当前 
会话可见,所有会话都看不到其他会话的数据,即使其他会话提交了,也看不到。临时表不存在并发行为,因为他们对于当前会话都是独立的。 
创建临时表时,ORACLE只创建了表的结构(在数据字典中定义),并没有初始化内存空间,当某一会话使用临时表时,ORALCE会</div>
                                </li>
                                <li><a href="/article/2512.htm"
                                       title="基于Nginx XSendfile+SpringMVC进行文件下载" target="_blank">基于Nginx XSendfile+SpringMVC进行文件下载</a>
                                    <span class="text-muted">denger</span>
<a class="tag" taget="_blank" href="/search/%E5%BA%94%E7%94%A8%E6%9C%8D%E5%8A%A1%E5%99%A8/1.htm">应用服务器</a><a class="tag" taget="_blank" href="/search/Web/1.htm">Web</a><a class="tag" taget="_blank" href="/search/nginx/1.htm">nginx</a><a class="tag" taget="_blank" href="/search/%E7%BD%91%E7%BB%9C%E5%BA%94%E7%94%A8/1.htm">网络应用</a><a class="tag" taget="_blank" href="/search/lighttpd/1.htm">lighttpd</a>
                                    <div>    在平常我们实现文件下载通常是通过普通 read-write方式,如下代码所示。 
 
   @RequestMapping("/courseware/{id}") 
   public void download(@PathVariable("id") String courseID, HttpServletResp</div>
                                </li>
                                <li><a href="/article/2639.htm"
                                       title="scanf接受char类型的字符" target="_blank">scanf接受char类型的字符</a>
                                    <span class="text-muted">dcj3sjt126com</span>
<a class="tag" taget="_blank" href="/search/c/1.htm">c</a>
                                    <div>/*
	2013年3月11日22:35:54
	目的:学习char只接受一个字符
*/
# include <stdio.h>

int main(void)
{
	int i;
	char ch;

	scanf("%d", &i);
	printf("i = %d\n", i);
	scanf("%</div>
                                </li>
                                <li><a href="/article/2766.htm"
                                       title="学编程的价值" target="_blank">学编程的价值</a>
                                    <span class="text-muted">dcj3sjt126com</span>
<a class="tag" taget="_blank" href="/search/%E7%BC%96%E7%A8%8B/1.htm">编程</a>
                                    <div>发一个人会编程, 想想以后可以教儿女, 是多么美好的事啊, 不管儿女将来从事什么样的职业, 教一教, 对他思维的开拓大有帮助 
  
像这位朋友学习:   
http://blog.sina.com.cn/s/articlelist_2584320772_0_1.html 
  
 
  VirtualGS教程 (By @林泰前): 几十年的老程序员,资深的</div>
                                </li>
                                <li><a href="/article/2893.htm"
                                       title="二维数组(矩阵)对角线输出" target="_blank">二维数组(矩阵)对角线输出</a>
                                    <span class="text-muted">飞天奔月</span>
<a class="tag" taget="_blank" href="/search/%E4%BA%8C%E7%BB%B4%E6%95%B0%E7%BB%84/1.htm">二维数组</a>
                                    <div>今天在BBS里面看到这样的面试题目, 
  
1,二维数组(N*N),沿对角线方向,从右上角打印到左下角如N=4: 4*4二维数组  
{ 1 2 3 4 }
{ 5 6 7 8 }
{ 9 10 11 12 }
{13 14 15 16 } 
打印顺序  
4
3 8
2 7 12
1 6 11 16
5 10 15
9 14
13 
要</div>
                                </li>
                                <li><a href="/article/3020.htm"
                                       title="Ehcache(08)——可阻塞的Cache——BlockingCache" target="_blank">Ehcache(08)——可阻塞的Cache——BlockingCache</a>
                                    <span class="text-muted">234390216</span>
<a class="tag" taget="_blank" href="/search/%E5%B9%B6%E5%8F%91/1.htm">并发</a><a class="tag" taget="_blank" href="/search/ehcache/1.htm">ehcache</a><a class="tag" taget="_blank" href="/search/BlockingCache/1.htm">BlockingCache</a><a class="tag" taget="_blank" href="/search/%E9%98%BB%E5%A1%9E/1.htm">阻塞</a>
                                    <div>可阻塞的Cache—BlockingCache 
  
       在上一节我们提到了显示使用Ehcache锁的问题,其实我们还可以隐式的来使用Ehcache的锁,那就是通过BlockingCache。BlockingCache是Ehcache的一个封装类,可以让我们对Ehcache进行并发操作。其内部的锁机制是使用的net.</div>
                                </li>
                                <li><a href="/article/3147.htm"
                                       title="mysqldiff对数据库间进行差异比较" target="_blank">mysqldiff对数据库间进行差异比较</a>
                                    <span class="text-muted">jackyrong</span>
<a class="tag" taget="_blank" href="/search/mysqld/1.htm">mysqld</a>
                                    <div>  mysqldiff该工具是官方mysql-utilities工具集的一个脚本,可以用来对比不同数据库之间的表结构,或者同个数据库间的表结构 
   如果在windows下,直接下载mysql-utilities安装就可以了,然后运行后,会跑到命令行下: 
 
1) 基本用法 
   mysqldiff --server1=admin:12345</div>
                                </li>
                                <li><a href="/article/3274.htm"
                                       title="spring data jpa 方法中可用的关键字" target="_blank">spring data jpa 方法中可用的关键字</a>
                                    <span class="text-muted">lawrence.li</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a>
                                    <div>spring data jpa 支持以方法名进行查询/删除/统计。 
查询的关键字为find 
删除的关键字为delete/remove (>=1.7.x) 
统计的关键字为count (>=1.7.x) 
  
修改需要使用@Modifying注解 
@Modifying
@Query("update User u set u.firstna</div>
                                </li>
                                <li><a href="/article/3401.htm"
                                       title="Spring的ModelAndView类" target="_blank">Spring的ModelAndView类</a>
                                    <span class="text-muted">nicegege</span>
<a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a>
                                    <div>项目中controller的方法跳转的到ModelAndView类,一直很好奇spring怎么实现的? 
/*
 * Copyright 2002-2010 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * yo</div>
                                </li>
                                <li><a href="/article/3528.htm"
                                       title="搭建 CentOS 6 服务器(13) - rsync、Amanda" target="_blank">搭建 CentOS 6 服务器(13) - rsync、Amanda</a>
                                    <span class="text-muted">rensanning</span>
<a class="tag" taget="_blank" href="/search/centos/1.htm">centos</a>
                                    <div>(一)rsync 
 
Server端 
 
# yum install rsync
# vi /etc/xinetd.d/rsync
    service rsync
    {
        disable = no
        flags           = IPv6
        socket_type     = stream
        wait    </div>
                                </li>
                                <li><a href="/article/3655.htm"
                                       title="Learn Nodejs 02" target="_blank">Learn Nodejs 02</a>
                                    <span class="text-muted">toknowme</span>
<a class="tag" taget="_blank" href="/search/nodejs/1.htm">nodejs</a>
                                    <div>(1)npm是什么   
npm is the package manager for node 
官方网站:https://www.npmjs.com/ 
npm上有很多优秀的nodejs包,来解决常见的一些问题,比如用node-mysql,就可以方便通过nodejs链接到mysql,进行数据库的操作 
在开发过程往往会需要用到其他的包,使用npm就可以下载这些包来供程序调用 
&nb</div>
                                </li>
                                <li><a href="/article/3782.htm"
                                       title="Spring MVC 拦截器" target="_blank">Spring MVC 拦截器</a>
                                    <span class="text-muted">xp9802</span>
<a class="tag" taget="_blank" href="/search/spring+mvc/1.htm">spring mvc</a>
                                    <div>Controller层的拦截器继承于HandlerInterceptorAdapter 
 
 HandlerInterceptorAdapter.java   1  public   abstract   class  HandlerInterceptorAdapter  implements  HandlerIntercep</div>
                                </li>
                </ul>
            </div>
        </div>
    </div>

<div>
    <div class="container">
        <div class="indexes">
            <strong>按字母分类:</strong>
            <a href="/tags/A/1.htm" target="_blank">A</a><a href="/tags/B/1.htm" target="_blank">B</a><a href="/tags/C/1.htm" target="_blank">C</a><a
                href="/tags/D/1.htm" target="_blank">D</a><a href="/tags/E/1.htm" target="_blank">E</a><a href="/tags/F/1.htm" target="_blank">F</a><a
                href="/tags/G/1.htm" target="_blank">G</a><a href="/tags/H/1.htm" target="_blank">H</a><a href="/tags/I/1.htm" target="_blank">I</a><a
                href="/tags/J/1.htm" target="_blank">J</a><a href="/tags/K/1.htm" target="_blank">K</a><a href="/tags/L/1.htm" target="_blank">L</a><a
                href="/tags/M/1.htm" target="_blank">M</a><a href="/tags/N/1.htm" target="_blank">N</a><a href="/tags/O/1.htm" target="_blank">O</a><a
                href="/tags/P/1.htm" target="_blank">P</a><a href="/tags/Q/1.htm" target="_blank">Q</a><a href="/tags/R/1.htm" target="_blank">R</a><a
                href="/tags/S/1.htm" target="_blank">S</a><a href="/tags/T/1.htm" target="_blank">T</a><a href="/tags/U/1.htm" target="_blank">U</a><a
                href="/tags/V/1.htm" target="_blank">V</a><a href="/tags/W/1.htm" target="_blank">W</a><a href="/tags/X/1.htm" target="_blank">X</a><a
                href="/tags/Y/1.htm" target="_blank">Y</a><a href="/tags/Z/1.htm" target="_blank">Z</a><a href="/tags/0/1.htm" target="_blank">其他</a>
        </div>
    </div>
</div>
<footer id="footer" class="mb30 mt30">
    <div class="container">
        <div class="footBglm">
            <a target="_blank" href="/">首页</a> -
            <a target="_blank" href="/custom/about.htm">关于我们</a> -
            <a target="_blank" href="/search/Java/1.htm">站内搜索</a> -
            <a target="_blank" href="/sitemap.txt">Sitemap</a> -
            <a target="_blank" href="/custom/delete.htm">侵权投诉</a>
        </div>
        <div class="copyright">版权所有 IT知识库 CopyRight © 2000-2050 E-COM-NET.COM , All Rights Reserved.
<!--            <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">京ICP备09083238号</a><br>-->
        </div>
    </div>
</footer>
<!-- 代码高亮 -->
<script type="text/javascript" src="/static/syntaxhighlighter/scripts/shCore.js"></script>
<script type="text/javascript" src="/static/syntaxhighlighter/scripts/shLegacy.js"></script>
<script type="text/javascript" src="/static/syntaxhighlighter/scripts/shAutoloader.js"></script>
<link type="text/css" rel="stylesheet" href="/static/syntaxhighlighter/styles/shCoreDefault.css"/>
<script type="text/javascript" src="/static/syntaxhighlighter/src/my_start_1.js"></script>





</body>

</html>