UI控件--ImageView和ImageButton
来源:互联网 发布:彩票大赢家软件 编辑:程序博客网 时间:2024/05/06 16:52
图片显示样式
- android:scaleType属性值有:center,fitXY,fitstart,fitend,centerCrop,centerInside等
- android:src 添加图片的属性
- 蒙版属性:android:tint=”#44ff0000”
- 未添加蒙版
- 添加蒙版效果
ImageView和ImageButton的使用基本相同,具体细节自行尝试。
通过网络上图片的网址直接显示在Image控件上
public static void sendHttpRequest(final String urls, final MyHttpCallBackListener httpCallBackListener){ new Thread(new Runnable() { @Override public void run() { HttpURLConnection conn = null; try { URL picUrl = null; picUrl = new URL(urls); Bitmap pngBM = BitmapFactory.decodeStream(picUrl.openStream()); httpCallBackListener.onFinish(pngBM); } catch (ProtocolException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); httpCallBackListener.onError(e); } finally { if (conn!=null){ conn.disconnect(); } } } }).start(); }
- 通过这个工具类,我们可以将图片在子线程中构造成一个Bitmap对象,并将其返回,然后在image控件中进行设置就可以了
- 这里应用了观察者模式,观察者模式参见网络编程–观察者模式
第三方包CircleImageView
- 首先我们需要导包
- 然后就是和普通的ImageView一样设置就可以了
<de.hdodenhof.circleimageview.CircleImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/pp"/>
0 0
- UI控件--ImageView和ImageButton
- Android UI设计——ImageView和ImageButton控件
- Android UI 设计——ImageView 和 ImageButton 控件
- Android02--Android之UI控件ImageView+ImageButton
- Android UI基础——ImageView&ImageButton控件
- ImageView和ImageButton
- ImageButton和ImageView
- ImageView和ImageButton
- imageview和imagebutton
- Android 控件之ImageButton、ImageView
- Android开发基础——UI——基础控件(imageView,imageButton)
- ImageView和ImageButton和Button
- Android中ImageView和ImageButton
- ImageButton和ImageView的使用
- ImageView和ImageButton的区别
- Android中的ImageView和ImageButton
- Android学习-常见的UI控件 Button和ImageButton
- Android 之 EditText ImageView ImageButton控件
- mysql 设置密码四种方式转载
- Linux打印串口数据
- POJ-2226-Muddy Fields-二分图-最小点覆盖
- 温故3:Java集合框架中的几个常用接口
- Android控件测量相关
- UI控件--ImageView和ImageButton
- iOS多线程之NSThread
- zabbix 自定义 key
- WindowsServer2008 R2 Enterprise(ServerCore) + SqlServer2008 R2
- 使用DbVisualizer导出DB2创建序列SQL
- wordpress站点地址配置错误,无法访问网站
- Activity向Fragment传值
- 连续子数组的最大和
- 集合框架和泛型