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/1902275159960645632.htm"
                           title="HarmonyOS NEXT 用户首选项(Preferences)在应用开发中的应用与机制" target="_blank">HarmonyOS NEXT 用户首选项(Preferences)在应用开发中的应用与机制</a>
                        <span class="text-muted"></span>
<a class="tag" taget="_blank" href="/search/%E6%9E%B6%E6%9E%84%E6%95%99%E8%82%B2/1.htm">架构教育</a>
                        <div>在移动应用开发中,用户首选项(Preferences)是一种常见的数据存储方式,用于保存用户的个性化设置或应用的配置信息。类似于Android中的SharedPreferences,Preferences以键值对(Key-Value)的形式将数据存储在应用的内存和本地文件中。本文将详细介绍Preferences的概念、运作机制、API使用以及相关的限制。一、用户首选项(Preferences)的概</div>
                    </li>
                    <li><a href="/article/1902274020858982400.htm"
                           title="ComPDFKit PDF SDK V1.6.0 新功能: 直接编辑PDF内的文字和图片!" target="_blank">ComPDFKit PDF SDK V1.6.0 新功能: 直接编辑PDF内的文字和图片!</a>
                        <span class="text-muted"></span>
<a class="tag" taget="_blank" href="/search/pdfsdkedittext/1.htm">pdfsdkedittext</a>
                        <div>支持的平台:iOSAndroidWindows新功能:编辑文字:添加、修改、删除PDF文件中的文字,支持设置PDF文件中原文字的大小、位置、颜色、对齐方式等Addedtextalignmentintextediting,includinglefttextalignment,righttextalignment,centertextalignment,andjustifytextalignment.</div>
                    </li>
                    <li><a href="/article/1902271360281931776.htm"
                           title="基于android平台的斗地主AI" target="_blank">基于android平台的斗地主AI</a>
                        <span class="text-muted">清源Eamonmon</span>
<a class="tag" taget="_blank" href="/search/cocos2d-x%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/1.htm">cocos2d-x学习笔记</a>
                        <div>本软件是基于android平台的斗地主AI,我们在源代码的基础之上,旨在改进AI的算法,使玩家具有更丰富的体验感,让NPC可以更为智能。(一)玩法解析:(1)发牌和叫牌:一副扑克54张,先为每个人发17张,剩下的3张作为底牌,玩家视自己手中的牌来确定自己是否叫牌。按顺序叫牌,谁出的分多谁就是地主,一般分数有1分,2分,3分。地主的底牌需要给其他玩家看过后才能拿到手中,最后地主20张牌,农民分别17</div>
                    </li>
                    <li><a href="/article/1902256482133536768.htm"
                           title="小米5miui10android,小米又一款手机适配Android 10!MIUI开发版暂停,米粉别着急!..." target="_blank">小米5miui10android,小米又一款手机适配Android 10!MIUI开发版暂停,米粉别着急!...</a>
                        <span class="text-muted">weixin_39843677</span>

                        <div>2020年3月看到市场上的智能手机又要迎来一波新形势,更多厂家开始在手机的外观、形态、材质上下功夫。2月发布的小米10系列,几次开卖总是遇到抢购无货状态,看来雷军的高端手机市场卓有成效。除了硬件之外,手机系统其实还是挺重要的,日常体验才是王道。看到iOS最近几次测试版的更新不如人意,bug太多就是日常应用也会有适配兼容难的现象,卡顿闪退带来的效果总是不太好,影响用户去正常使用手机。再看看安卓阵营,</div>
                    </li>
                    <li><a href="/article/1902255725648867328.htm"
                           title="Jetpack组件在MVVM架构中的应用" target="_blank">Jetpack组件在MVVM架构中的应用</a>
                        <span class="text-muted">Ya-Jun</span>
<a class="tag" taget="_blank" href="/search/%E6%9E%B6%E6%9E%84/1.htm">架构</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a>
                        <div>Jetpack组件在MVVM架构中的应用一、引言Jetpack是Android官方推出的一套开发组件工具集,它能够帮助开发者构建高质量、可维护的Android应用。本文将深入探讨Jetpack核心组件在MVVM架构中的应用。二、ViewModel组件2.1ViewModel基本原理ViewModel是MVVM架构中最重要的组件之一,它具有以下特点:生命周期感知数据持久化避免内存泄漏2.2ViewM</div>
                    </li>
                    <li><a href="/article/1902201499719626752.htm"
                           title="Android通过uri 获取文件路径" target="_blank">Android通过uri 获取文件路径</a>
                        <span class="text-muted">迷路国王</span>
<a class="tag" taget="_blank" href="/search/Android%E7%9F%A5%E8%AF%86/1.htm">Android知识</a>
                        <div>话不多说,通过uri获取文件路径遇到了很多坑,但也最终解决了,直接上代码。importandroid.content.ContentResolver;importandroid.content.ContentUris;importandroid.content.Context;importandroid.database.Cursor;importandroid.net.Uri;importand</div>
                    </li>
                    <li><a href="/article/1902196831799013376.htm"
                           title="android开发—项目结构设计" target="_blank">android开发—项目结构设计</a>
                        <span class="text-muted">LaFerrariLi</span>
<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/%E7%BB%93%E6%9E%84/1.htm">结构</a><a class="tag" taget="_blank" href="/search/%E7%BB%8F%E9%AA%8C/1.htm">经验</a><a class="tag" taget="_blank" href="/search/%E8%AE%BE%E8%AE%A1/1.htm">设计</a><a class="tag" taget="_blank" href="/search/%E7%A7%BB%E5%8A%A8%E5%BC%80%E5%8F%91/1.htm">移动开发</a>
                        <div>我作为一名Android开发者也有好几年的经历了,从打杂开始到带领几个人的小团队开发,写过的项目也有很多了,从小到几十个页面的到几百个页面的,也算是积累了一些移动开发的经验了。我在这些年的工作当中发现很多开发者都喜欢把所有的代码,类放在一个项目下,甚至还有人把Adapter放在Activity中,这些做法显然是不好的首先是看起来很不方便,结构很乱,不利于优化和修改,时间长了项目大了之后,迭代简直就</div>
                    </li>
                    <li><a href="/article/1902161378513317888.htm"
                           title="安卓环境脚本" target="_blank">安卓环境脚本</a>
                        <span class="text-muted">nb的码农</span>
<a class="tag" taget="_blank" href="/search/linux%E6%9D%82%E9%A1%B9/1.htm">linux杂项</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a>
                        <div>sudoapt-getinstalluuiduuid-devzlib1g-devliblz-devliblzo2-2liblzo2-devlzopgit-corecurlu-boot-toolsmtd-utilsandroid-tools-fsutilsopenjdk-8-jdkdevice-tree-compiler\gdiskm4libz-devgitgnupgflexbisongperfli</div>
                    </li>
                    <li><a href="/article/1902157341785124864.htm"
                           title="【大模型开发】ONNX 格式的大模型在 Android 上的部署与测试" target="_blank">【大模型开发】ONNX 格式的大模型在 Android 上的部署与测试</a>
                        <span class="text-muted">云博士的AI课堂</span>
<a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%A8%A1%E5%9E%8B%E6%8A%80%E6%9C%AF%E5%BC%80%E5%8F%91%E4%B8%8E%E5%AE%9E%E8%B7%B5/1.htm">大模型技术开发与实践</a><a class="tag" taget="_blank" href="/search/%E5%93%88%E4%BD%9B%E5%8D%9A%E5%90%8E%E5%B8%A6%E4%BD%A0%E7%8E%A9%E8%BD%AC%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/1.htm">哈佛博后带你玩转机器学习</a><a class="tag" taget="_blank" href="/search/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0/1.htm">深度学习</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%A8%A1%E5%9E%8B%E9%83%A8%E7%BD%B2/1.htm">大模型部署</a><a class="tag" taget="_blank" href="/search/%E6%9C%AC%E5%9C%B0%E6%8E%A8%E7%90%86%E5%BC%95%E6%93%8E/1.htm">本地推理引擎</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%A8%A1%E5%9E%8B%E5%BC%80%E5%8F%91/1.htm">大模型开发</a><a class="tag" taget="_blank" href="/search/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/1.htm">机器学习</a><a class="tag" taget="_blank" href="/search/%E8%BE%B9%E7%BC%98%E8%AE%BE%E5%A4%87/1.htm">边缘设备</a>
                        <div>以下内容将以ONNX格式的大模型在Android上的部署与测试为核心,提供一套可运行的示例(基于AndroidStudio/Gradle),并结合代码进行详细讲解。最后会给出一些针对在移动设备上部署ONNX推理的优化方法和未来建议。目录整体流程概述准备工作2.1ONNX模型准备2.2Android项目准备在Android上使用ONNXRuntime3.1添加依赖3.2项目结构说明3.3代码示例运行</div>
                    </li>
                    <li><a href="/article/1902135271768518656.htm"
                           title="kotlin 万能适配器" target="_blank">kotlin 万能适配器</a>
                        <span class="text-muted">шесай-ай-ай-ай-ай, ч</span>
<a class="tag" taget="_blank" href="/search/kotlin/1.htm">kotlin</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/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a>
                        <div>Kotlin语言的直接考这四个类直接拿来用就可以了RecyclerBaseAdapter类packagecom.xxxx.pad.base.adapterimportandroid.content.Contextimportandroid.view.LayoutInflaterimportandroid.view.Viewimportandroid.view.ViewGroupimportandr</div>
                    </li>
                    <li><a href="/article/1902135145251532800.htm"
                           title="android app锁定后台运行的方法" target="_blank">android app锁定后台运行的方法</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%BA%90%E7%A0%81/1.htm">源码</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a>
                        <div>想直接看图操作,可以android下一个小米穿戴然后我->开启后台运行权限->点击当前手机后面的里面有小米MIUI,华为EMUI,OPPOColorOS,VivoFuntouchOS,图文并茂的教你各个系统怎么开启后台运行权限的;因为安卓系统后台程序限制,软件在长时间挂后台运行时会被系统杀掉,可以将程序加入清理白名单中,并在手机系统设置中的“电池->后台高耗电中允许软件后台高耗电”具体方法如下:1</div>
                    </li>
                    <li><a href="/article/1902101326054092800.htm"
                           title="Android Bootable Recovery 中的 `imgdiff.cpp` 文件解析" target="_blank">Android Bootable Recovery 中的 `imgdiff.cpp` 文件解析</a>
                        <span class="text-muted">zhangjiaofa</span>
<a class="tag" taget="_blank" href="/search/android/1.htm">android</a>
                        <div>AndroidBootableRecovery中的imgdiff.cpp文件解析引言在Android系统中,Recovery模式是一个非常重要的组成部分,它允许用户在设备无法正常启动时进行系统修复、数据恢复、OTA更新等操作。其中,OTA(Over-The-Air)更新是Android系统中常见的更新方式,它通过网络下载更新包并应用到设备上。为了优化更新包的大小,Android提供了一个高效的差分</div>
                    </li>
                    <li><a href="/article/1902096904171352064.htm"
                           title="Android Api Demos登顶之路(九十五)Media-->AudioFx" target="_blank">Android Api Demos登顶之路(九十五)Media-->AudioFx</a>
                        <span class="text-muted">fishtosky</span>
<a class="tag" taget="_blank" href="/search/Android/1.htm">Android</a><a class="tag" taget="_blank" href="/search/ApiDemos/1.htm">ApiDemos</a><a class="tag" taget="_blank" href="/search/apidemon/1.htm">apidemon</a><a class="tag" taget="_blank" href="/search/audio/1.htm">audio</a><a class="tag" taget="_blank" href="/search/mediaplayer/1.htm">mediaplayer</a><a class="tag" taget="_blank" href="/search/visulizer/1.htm">visulizer</a><a class="tag" taget="_blank" href="/search/equalizer/1.htm">equalizer</a>
                        <div>/**这个demon演示了在进行音频播放时如何使用Visualizer和Equalizer类为音频定制*示波器和均衡器。*/publicclassMainActivityextendsActivity{//定义示波器界面的高度(单位为dip)privatestaticfinalfloatVISUALIZER_HEIGHT_DIP=50f;//定义一个媒体播放器privateMediaPlayerm</div>
                    </li>
                    <li><a href="/article/1902096650743115776.htm"
                           title="Android 使用MediaPlayer播放音频详解" target="_blank">Android 使用MediaPlayer播放音频详解</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/java/1.htm">java</a>
                        <div>目录一、官方资料二、简单介绍三、MediaPlayer使用1.创建MediaPlayer实例2.重要API3.状态图4.代码5.常用API6.辅助效果总结一、官方资料MediaPlayer概览https://developer.android.google.cn/guide/topics/media/mediaplayer?hl=zh_cnMediaPlayer文档https://develope</div>
                    </li>
                    <li><a href="/article/1902096398506061824.htm"
                           title="The import android.media.audiofx.AcousticEchoCanceler cannot be resolved" target="_blank">The import android.media.audiofx.AcousticEchoCanceler cannot be resolved</a>
                        <span class="text-muted">Dev_Hanyu</span>
<a class="tag" taget="_blank" href="/search/Android%E5%BC%80%E5%8F%91/1.htm">Android开发</a>
                        <div>RT.android.media.audiofx.AcousticEchoCanceler,AddedinAPIlevel16需要将App的目标SDK版本变成16选择项目右键properties,选择Android,然后勾选版本SDK-16.版本选择最好是看下工程的AndroidManifest.xml,选择一样的。target:SDK-16。成功!</div>
                    </li>
                    <li><a href="/article/1902094758583529472.htm"
                           title="Android面试总结(Android篇)" target="_blank">Android面试总结(Android篇)</a>
                        <span class="text-muted">Rookie、Zyu</span>
<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/%E8%81%8C%E5%9C%BA%E5%92%8C%E5%8F%91%E5%B1%95/1.htm">职场和发展</a>
                        <div>Android相关Activity:OnSaveInstanceState(BundleoutState)OnRestoreInstanceState(BundlesavedInstanceState)横竖屏切换时设置configchanges="orientation|screenSize"不会重新调用各个生命周期,会执行onConfigurationChanged方法。启动模式:1.标准模式s</div>
                    </li>
                    <li><a href="/article/1902090718097240064.htm"
                           title="《Android启动侦探团:追踪Launcher启动的“最后一公里”》" target="_blank">《Android启动侦探团:追踪Launcher启动的“最后一公里”》</a>
                        <span class="text-muted">KdanMin</span>
<a class="tag" taget="_blank" href="/search/%E3%80%90%E9%AB%98%E9%80%9A/1.htm">【高通</a><a class="tag" taget="_blank" href="/search/Android/1.htm">Android</a><a class="tag" taget="_blank" href="/search/%E7%B3%BB%E7%BB%9F%E5%BC%80%E5%8F%91%E7%B3%BB%E5%88%97%E3%80%91/1.htm">系统开发系列】</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a>
                        <div>1.开机仪式的“黑屏悬案”当Android设备完成开机动画后,某些产品会陷入诡异的“黑屏时刻”——仿佛系统在玩捉迷藏。此时,**Launcher(桌面)**就是躲猫猫的主角。我们的任务:揪出Launcher何时完成启动,终结黑屏之谜!2.关键线索:四大“侦探类”破案需要以下四位“技术侦探”联手:ActivityThread——负责导演Activity的“人生大戏”ActivityClientCon</div>
                    </li>
                    <li><a href="/article/1902089458241564672.htm"
                           title="设计模式详解(十二):单例模式——Singleton" target="_blank">设计模式详解(十二):单例模式——Singleton</a>
                        <span class="text-muted">jungle_pig</span>
<a class="tag" taget="_blank" href="/search/%E5%8D%95%E4%BE%8B%E6%A8%A1%E5%BC%8F/1.htm">单例模式</a><a class="tag" taget="_blank" href="/search/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/1.htm">设计模式</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a>
                        <div>什么是单例模式单例模式(SingletonPattern)是一种常见的设计模式,用于确保一个类在整个应用程序运行期间只有一个实例,并提供全局访问点。本文将详细介绍单例模式的定义、实现方式、优缺点,以及Android源码中的使用实例,配以图解与注释。单例模式的核心目标是:唯一性:确保类只有一个实例。全局访问:提供对该实例的全局访问。UML类图以下是单例模式的UML类图:Singleton-stati</div>
                    </li>
                    <li><a href="/article/1902087317150035968.htm"
                           title="Android 面试(Java 篇)" target="_blank">Android 面试(Java 篇)</a>
                        <span class="text-muted">约翰先森不喝酒</span>
<a class="tag" taget="_blank" href="/search/%E9%9D%A2%E8%AF%95/1.htm">面试</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/%E9%9D%A2%E8%AF%95/1.htm">面试</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a>
                        <div>Android面试(Java篇)一Java的继承机制二进程跟线程,以及线程的创建三简述wait()和sleep()的区别四如何终止一个线程五Synchronized(内置锁,线程同步)六Synchronized修饰的静态和非静态方法时为什么可以异步执行?七线程同步除了Synchronized还有别的方法么,区别在哪里八死锁产生的原因以及预防措施九Synchronized和Lock的区别十Handl</div>
                    </li>
                    <li><a href="/article/1902086809110769664.htm"
                           title="Android第四次面试总结(基础算法篇)" target="_blank">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/%E9%9D%A2%E8%AF%95/1.htm">面试</a><a class="tag" taget="_blank" href="/search/%E7%AE%97%E6%B3%95/1.htm">算法</a>
                        <div>一、反转链表//定义链表节点类classListNode{//节点存储的值intval;//指向下一个节点的引用ListNodenext;//构造函数,用于初始化节点的值ListNode(intx){val=x;}}classSolution{//反转链表的方法publicListNodereverseList(ListNodehead){//初始化前一个节点为nullListNodeprev=n</div>
                    </li>
                    <li><a href="/article/1902086809819607040.htm"
                           title="Android 高频面试必问之Java基础" target="_blank">Android 高频面试必问之Java基础</a>
                        <span class="text-muted">2401_83641443</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/java/1.htm">java</a>
                        <div>BootstrapClassLoader:Bootstrap类加载器负责加载rt.jar中的JDK类文件,它是所有类加载器的父加载器。Bootstrap类加载器没有任何父类加载器,如果调用String.class.getClassLoader(),会返回null,任何基于此的代码会抛出NUllPointerException异常,因此Bootstrap加载器又被称为初始类加载器。ExtClassL</div>
                    </li>
                    <li><a href="/article/1902085672194338816.htm"
                           title="Android第三次面试(Java基础)" target="_blank">Android第三次面试(Java基础)</a>
                        <span class="text-muted">每次的天空</span>
<a class="tag" taget="_blank" href="/search/%E9%9D%A2%E8%AF%95/1.htm">面试</a><a class="tag" taget="_blank" href="/search/%E8%81%8C%E5%9C%BA%E5%92%8C%E5%8F%91%E5%B1%95/1.htm">职场和发展</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a>
                        <div>面试题一:在Android里,Array和ArrayList区别?定义与大小:数组声明时要指定大小,之后固定;ArrayList动态,无需提前定大小。性能:二者访问元素快,时间复杂度O(1);数组插入删除繁琐,ArrayList尾部添加快,其他位置操作慢。数据类型:数组能存基本类型和对象,ArrayList只能存对象,存基本类型需用包装类。方法功能:数组自身方法少,靠Arrays类;ArrayLi</div>
                    </li>
                    <li><a href="/article/1902069535628914688.htm"
                           title="Android Fresco 框架扩展模块源码深度剖析(四)" target="_blank">Android Fresco 框架扩展模块源码深度剖析(四)</a>
                        <span class="text-muted">&有梦想的咸鱼&</span>
<a class="tag" taget="_blank" href="/search/Anddroid/1.htm">Anddroid</a><a class="tag" taget="_blank" href="/search/Fresco%E5%8E%9F%E7%90%86%E5%88%86%E6%9E%90/1.htm">Fresco原理分析</a><a class="tag" taget="_blank" href="/search/Android%E5%BC%80%E5%8F%91%E5%A4%A7%E5%85%A8/1.htm">Android开发大全</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a>
                        <div>一、引言在Android开发领域,图片处理一直是一个重要且具有挑战性的任务。Fresco作为Facebook开源的强大图片加载框架,在图片的加载、缓存和显示等方面已经提供了非常完善的功能。然而,为了满足不同开发者多样化的需求,Fresco设计了丰富的扩展模块,这些扩展模块允许开发者根据自身项目的特点对框架进行定制和扩展。本文将深入剖析Fresco框架的扩展模块,从源码级别进行详细分析,帮助开发者更</div>
                    </li>
                    <li><a href="/article/1902068525799895040.htm"
                           title="解锁Android开发利器:MVVM架构_android的mvvm(2),2024年最新kotlin高阶函数" target="_blank">解锁Android开发利器:MVVM架构_android的mvvm(2),2024年最新kotlin高阶函数</a>
                        <span class="text-muted">Java图灵架构</span>
<a class="tag" taget="_blank" href="/search/2024%E5%B9%B4%E7%A8%8B%E5%BA%8F%E5%91%98%E5%AD%A6%E4%B9%A0/1.htm">2024年程序员学习</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/%E6%9E%B6%E6%9E%84/1.htm">架构</a><a class="tag" taget="_blank" href="/search/kotlin/1.htm">kotlin</a>
                        <div>classWeatherViewModel:ViewModel(){privatevalweatherRepository=WeatherRepository()privateval_weather=MutableLiveData()valweather:LiveData=_weatherfunfetchWeather(city:String){valweatherData=weatherRepo</div>
                    </li>
                    <li><a href="/article/1902067768644136960.htm"
                           title="探索现代Android开发的杰作:基于Kotlin的MVVM应用" target="_blank">探索现代Android开发的杰作:基于Kotlin的MVVM应用</a>
                        <span class="text-muted">郁楠烈Hubert</span>

                        <div>探索现代Android开发的杰作:基于Kotlin的MVVM应用kotlin-mvvm-hilt-flow-appKotlinfirstappusingCleanArchitecturewithMVVMpatternalongwithAndroidArchitectureComponentssuchasLiveData,ViewModel,NavigationandidiomaticKotlinu</div>
                    </li>
                    <li><a href="/article/1902009399593988096.htm"
                           title="如何将rust日志输出到android终端" target="_blank">如何将rust日志输出到android终端</a>
                        <span class="text-muted"></span>
<a class="tag" taget="_blank" href="/search/%E7%BC%96%E8%BE%91%E5%99%A8/1.htm">编辑器</a>
                        <div>本博客所有文章除特别声明外,均采用CCBY-NC-SA4.0许可协议。转载请注明来自唯你背景在Rust中,使用println!打印日志时,输出实际上是发送到标准输出(stdout),而AndroidLogcat专门用于处理和显示应用程序的日志信息,此环境下标准输出实现被重新定义。这意味着Rust日志输出不会出现在Logcat中。android_logger直接与Android的日志系统集成,确保日</div>
                    </li>
                    <li><a href="/article/1902002595933777920.htm"
                           title="《基于Workspace.java的Launcher3改造:HotSeat区域动态阻断文件夹生成机制》" target="_blank">《基于Workspace.java的Launcher3改造:HotSeat区域动态阻断文件夹生成机制》</a>
                        <span class="text-muted">KdanMin</span>
<a class="tag" taget="_blank" href="/search/%E3%80%90%E9%AB%98%E9%80%9A/1.htm">【高通</a><a class="tag" taget="_blank" href="/search/Android/1.htm">Android</a><a class="tag" taget="_blank" href="/search/%E7%B3%BB%E7%BB%9F%E5%BC%80%E5%8F%91%E7%B3%BB%E5%88%97%E3%80%91/1.htm">系统开发系列】</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a>
                        <div>1.需求背景与技术挑战在Android13系统Launcher3定制化开发中,需实现禁止HotSeat区域创建文件夹的功能。原始逻辑中,当用户拖拽应用图标至HotSeat区域相邻图标时,会触发FolderIcon的实例化。本文将深入分析Launcher3的文件夹创建机制,并提供可靠的解决方案。2.核心修改文件定位复制packages/apps/Launcher3/src/com/android/l</div>
                    </li>
                    <li><a href="/article/1901990368287715328.htm"
                           title="react-native中使用axios_React Native 三端同构实践" target="_blank">react-native中使用axios_React Native 三端同构实践</a>
                        <span class="text-muted">weixin_39874795</span>

                        <div>ReactNative三端同构实践来源:ibm.com/cnReactNative三端(Web、iOS、Android)同构是指在不改动原ReactNative的代码下,让其在浏览器中运行出和在ReactNative环境下一样的页面。对于使用ReactNative开发的页面,如果又单独为Web平台重复写一份代码代价是极其大的,而ReactNative三端同构能以零花费快速做到一份代码三端复用。Re</div>
                    </li>
                    <li><a href="/article/1901953665221062656.htm"
                           title="Android Zygote的进程机制" target="_blank">Android Zygote的进程机制</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/zygote/1.htm">zygote</a><a class="tag" taget="_blank" href="/search/github/1.htm">github</a><a class="tag" taget="_blank" href="/search/%E6%A8%A1%E5%9D%97%E6%B5%8B%E8%AF%95/1.htm">模块测试</a>
                        <div>目录✅AndroidZygote进程机制详解一、Zygote的作用⚙️二、Zygote启动流程✅1.init进程启动Zygote✅2.Zygote初始化虚拟机与核心类库✅3.Zygote监听Socket✅4.Zygotefork创建应用进程三、Zygote与应用进程之间的关系四、Zygote多进程模型️五、Zygote性能优化机制✅六、Zygote的安全性总结✅AndroidZygote进程机制详</div>
                    </li>
                    <li><a href="/article/1901940559178690560.htm"
                           title="fastapi+angular实现Tcp在线聊天室功能" target="_blank">fastapi+angular实现Tcp在线聊天室功能</a>
                        <span class="text-muted">勘察加熊人</span>
<a class="tag" taget="_blank" href="/search/typescript/1.htm">typescript</a><a class="tag" taget="_blank" href="/search/fastapi/1.htm">fastapi</a><a class="tag" taget="_blank" href="/search/angular.js/1.htm">angular.js</a><a class="tag" taget="_blank" href="/search/tcp%2Fip/1.htm">tcp/ip</a>
                        <div>说明:我计划用fastapi+angular,实现一个在线聊天室的功能,1.必须有一个服务端和多个客户端2.用一个列表,显示当前所有在线的用户3.所有在线的用户,必须实现群聊和单独聊天效果图:新增安卓测试程序C:\Users\wangrusheng\AndroidStudioProjects\MyApplication9\app\src\test\java\com\example\myapplic</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>