android - 如何使用服务类中的布局访问 ImageView?
问题描述
我想从我的 Service 类中更改 ImageView 的颜色。但我不知道如何从服务类访问 ImageView。这是我的布局文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:layout_alignParentStart ="true"
android:layout_centerVertical = "true"
android:src="@drawable/batman_r"/>
</RelativeLayout>
我想从我的 Service 类中更改 ImageView 的颜色。但我不知道如何从服务类访问 ImageView。我只想 getImageView 并从中获取可绘制性并将其 Tint 设置为我想要的颜色。请他
解决方案
推荐阅读
- flutter - Flutter:如何将前景添加到可关闭的小部件
- javascript - 表单输入数字 onchange
- c# - ASP.NET API 请求未成功完成
- java - 根据 JAX-RS 中的规范使用带有 @PathParam 的 PathSegment?
- flutter - Flutter BLoC:mapEventToState 的全局异常处理程序
- javascript - 如何一一执行 PHP 和 Javascript 代码?
- javascript - CryptoJS.HmacSHA256 与 Indy10 TIdHMACSHA256.HashValue
- java - 从 java -jar 运行 Spring Boot 应用程序时未提交事务
- reactjs - 如何在 React 中将多维数组作为道具传递?
- python - 索引时元组解包