Android应用中如何将图片的单位进行转换-创新互联

这篇文章给大家介绍Android应用中如何将图片的单位进行转换,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

为象山等地区用户提供了全套网页设计制作服务,及象山网站建设行业解决方案。主营业务为成都网站设计、网站建设、象山网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

ImageSwitcher: 

图像查看器,好像是老组件了,今天先更一个基础的组件,后期如果有时间继续扩展.

那么图像查看器,就是和 Windows 系统下的图片查看器比较类似.自带上一张和下一张的功能.

这个组件有以下几个特点,本人感觉:

1.该组件属于容器性质;

Android应用中如何将图片的单位进行转换

2.ImageSwitcher 本身继承了 FrameLayout, 也可以使用帧布局的一些属性.

3.在使用 ImageSwitcher 的时候,必须实现 ViewSwitcher.ViewFactory 的接口,然后通过复写 makeView() 方法来创建用于显示图片的 ImageView,并且 makeView()方法返回一个显示图片的 ImageView.

4.图片加载 ImageView 上的话,如果是本地资源的话,需要使用 setImageResource() 方法.

上面基本的原理大致描述清楚,下面上代码

XML 布局文件,这里面只有2个按钮和 ImageSwitcher 的组件

<&#63;xml version="1.0" encoding="utf-8"&#63;>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:gravity="center"
  android:orientation="horizontal">

  <Button
    android:id="@+id/up_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="上一张" />

  <!-- 图像转换器-->
  <ImageSwitcher
    android:id="@+id/main_imageswitcher"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center" />

  <Button
    android:id="@+id/down_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="下一张" />

</LinearLayout>

新闻标题:Android应用中如何将图片的单位进行转换-创新互联
文章来源:https://www.cdcxhl.com/article46/cojoeg.html

成都网站建设公司_创新互联,为您提供定制网站静态网站品牌网站设计全网营销推广网站制作用户体验

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

小程序开发