iis服务器助手广告广告
返回顶部
首页 > 资讯 > 精选 >Android Studio中ButterKnife插件的安装与使用详解
  • 608
分享到

Android Studio中ButterKnife插件的安装与使用详解

2023-05-30 16:05:13 608人浏览 薄情痞子
摘要

1》Android Studio 安装ButterKnife插件同安装其他插件类似,如下:1》打开Plugins界面按照上图中1,2,3指示操作(注意:这里我的Android Studio中已经安装了该插件,所以显示的内容不太一样)。然后重

1》Android Studio 安装ButterKnife插件

同安装其他插件类似,如下:

1》打开Plugins界面

Android Studio中ButterKnife插件的安装与使用详解

Android Studio中ButterKnife插件的安装与使用详解

按照上图中1,2,3指示操作(注意:这里我的Android Studio中已经安装了该插件,所以显示的内容不太一样)。然后重启Android Studio。

2》在项目上使用该开源项目(以Android Studio 为例)

1》在bulid.gradle中添加依赖

Android Studio中ButterKnife插件的安装与使用详解

重新编译一下该项目,通过后继续操作。

2》在代码中就可以使用注解的方式了

2.1》示例布局文件如下:

<LinearLayout xmlns:android="Http://schemas.android.com/apk/res/android"   xmlns:tools="http://schemas.android.com/tools"   android:layout_width="match_parent"   android:layout_height="match_parent"   android:orientation="vertical"   android:paddingBottom="@dimen/activity_vertical_margin"   android:paddingLeft="@dimen/activity_horizontal_margin"   android:paddingRight="@dimen/activity_horizontal_margin"   android:paddingTop="@dimen/activity_vertical_margin"   tools:context=".MainActivity">    <TextView     android:id="@+id/text_veiw_tv1"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:text="TextView 1" />    <Button     android:id="@+id/button_bt1"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:text="Button1" />    <TextView      android:id="@+id/text_veiw_tv2"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:text="TextView 2" />     <Button     android:id="@+id/button_bt2"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:text="Button2" />   </LinearLayout> 

--结束END--

本文标题: Android Studio中ButterKnife插件的安装与使用详解

本文链接: https://www.lsjlt.com/news/219888.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作