ExtendedTouchView, 仅使用XML操作视图触摸目标的Android库

分享于 

3分钟阅读

GitHub

  繁體 雙語
Android library for manipulating view touch targets using XML only.
  • 源代码名称:ExtendedTouchView
  • 源代码网址:http://www.github.com/lnikkila/ExtendedTouchView
  • ExtendedTouchView源代码文档
  • ExtendedTouchView源代码下载
  • Git URL:
    git://www.github.com/lnikkila/ExtendedTouchView.git
    Git Clone代码到本地:
    git clone http://www.github.com/lnikkila/ExtendedTouchView
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/lnikkila/ExtendedTouchView
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    ExtendedTouchView

    想要一些背景看看这个博客帖子。

    你注意到材质指南指定触摸目标有时应大于实际视图?

    查看这里对话框的按钮,例如:

    使用 TouchDelegate有点笨拙,将它抽象出来,你可以使用普通的ol xml将这些目标设置为任意大小,如:

    <com.lnikkila.extendedtouchview.ExtendedTouchView
     android:layout_width="wrap_content"android:layout_height="wrap_content"app:touchHeight="48dp">
     <Buttonandroid:id="@+id/button"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/button"/>
    </com.lnikkila.extendedtouchview.ExtendedTouchView>

    就是这样 !

    安装

    你可以在 JCenter 上获得编译过的库。

    把这个放到你的build.gradle 里:

    compile 'com.lnikkila:extendedtouchview:0.1.0'

    许可证

    
    ISC License (ISC)
    
    
    
    Copyright (c) 2015, Leo Nikkilä
    
    
    
    Permission to use, copy, modify, and/or distribute this software for any purpose
    
    
    with or without fee is hereby granted, provided that the 上面 copyright notice
    
    
    and this permission notice appear in all copies.
    
    
    
    THE SOFTWARE IS PROVIDED"AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
    
    
    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
    
    
    FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
    
    
    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
    
    
    OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
    
    
    TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
    
    
    THIS SOFTWARE.
    
    
    
    

    MAN  VIEW  触摸  android-l  Android 库  TAR  
    相关文章