帮酷LOGO
0 0 评论
  • 显示原文与译文双语对照的内容
文章标签:图像  reusable  VIEW  disp  Imageview  edittext  EDI  
Reusable view for displaying an ImageView with an EditText for Android 4.0 +

  • 源代码名称:IconEditText
  • 源代码网址:http://www.github.com/KyleBanks/IconEditText
  • IconEditText源代码文档
  • IconEditText源代码下载
  • Git URL:
    git://www.github.com/KyleBanks/IconEditText.git
  • Git Clone代码到本地:
    git clone http://www.github.com/KyleBanks/IconEditText
  • Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/KyleBanks/IconEditText
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
  • 面向Android的 IconEditText

    IconEditText 提供了一个可以重用视图,用于显示带有 Android 4.0 +EditTextImageView

    用法

    使用 IconEditText 很简单,只需克隆 repo 并将它的添加到你的项目中作为一个库应用程序。

    添加库之后,你可以添加类似于下面这样的IconEditText:

    XML

    <!-- Note the declaration of the `widget` namespace. --><LinearLayout 
    . . .
     xmlns:widget="http://schemas.android.com/apk/res-auto">
     <com.kylewbanks.android.iconedittext.IconEditText
     android:layout_width="match_parent"android:layout_height="wrap_content"widget:isPassword="false"widget:hint="@string/username"widget:iconSrc="@drawable/username_icon"/>
    </LinearLayout>
    命令行选项

    IconEditText 当前支持以下属性:

    • isPassword {Boolean}: 如果 true,将屏蔽edittext的输入。
    • 提示 {String}: 要显示的提示文本,如果有的话。
    • iconSrc {Drawable}: 要显示的icon 图像的源。

    Java

    从Java中,你可以像其他视图一样引用 IconEditText。 例如从 Activity:

    IconEditText iconEditText = (IconEditText) findViewById(...);

    你可以像下面这样访问底层的EditTextImageView:

    EditText editText = iconEditText.getEditText();ImageView imageView = iconEditText.getImageView();

    还提供了访问以下 EditTextEditable的便捷方法:

    Editable editable = iconEditText.getText();

    作者

    Kyle银行

    许可证

    
    The MIT License (MIT)
    
    
    
    Copyright (c) 2015 Kyle Banks
    
    
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    
    
    of this software and associated documentation files (the"Software"), to deal
    
    
    in the Software without restriction, including without limitation the rights
    
    
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    
    
    copies of the Software, and to permit persons to whom the Software is
    
    
    furnished to do so, subject to the following conditions:
    
    
    
    The 上面 copyright notice and this permission notice shall be included in
    
    
    all copies or substantial portions of the Software.
    
    
    
    THE SOFTWARE IS PROVIDED"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    
    
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    
    
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    
    
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    
    
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    
    
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    
    
    THE SOFTWARE.
    
    
    
    


    文章标签:图像  VIEW  EDI  disp  reusable  Imageview  edittext  

    Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备05059198号-3  |  如果智培  |  酷兔英语