小编Dev*_*n S的帖子

色调属性不适用于浮动操作按钮 - 无法更改图标颜色

我正在尝试做一些非常简单的事情,在浮动操作按钮上设置图标的色调,但色调属性不会改变它的颜色。

即使更改了图标的 XML 本身,浮动操作按钮似乎仍将图标保持为黑色。

我只是想把图标改成白色!

FAB XML:

<com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/createPostBtn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        android:backgroundTint="#006993"
        android:clickable="true"
        android:focusable="true"
        android:src="@drawable/ic_textpost"
        android:tint="@color/white"
        app:layout_constraintBottom_toTopOf="@+id/add_btn"
        app:layout_constraintEnd_toEndOf="@+id/add_btn" />
Run Code Online (Sandbox Code Playgroud)

ic_textpost.xml:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="@color/white">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M17,19.22H5V7h7V5H5C3.9,5 3,5.9 3,7v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-7h-2V19.22z"/>
  <path
      android:fillColor="@android:color/white"
      android:pathData="M19,2h-2v3h-3c0.01,0.01 0,2 0,2h3v2.99c0.01,0.01 2,0 2,0V7h3V5h-3V2z"/>
  <path
      android:fillColor="@android:color/white"
      android:pathData="M7,9h8v2h-8z"/>
  <path
      android:fillColor="@android:color/white"
      android:pathData="M7,12l0,2l8,0l0,-2l-3,0z"/>
  <path
      android:fillColor="@android:color/white"
      android:pathData="M7,15h8v2h-8z"/>
</vector>
Run Code Online (Sandbox Code Playgroud)

当前FAB

android android-layout android-icons floating-action-button

3
推荐指数
1
解决办法
1491
查看次数

将函数列表传递给 asyncio.gather()

from aiohttp import ClientSession
import asyncio
import threading
import time     

 class Query():

    def execute_async(self):
    asyncio.run(self.call_requests())

    async def call_requests(self):
        self.api_request_list = []

        self.PROMETHEUS_URL = "http://www.randomnumberapi.com/api/v1.0/random?min=100&max=1000&count=1"

        self.api_request_list.append(self.api_request(self.PROMETHEUS_URL, 1))
        self.api_request_list.append(self.api_request(self.PROMETHEUS_URL, 1))
        self.api_request_list.append(self.api_request(self.PROMETHEUS_URL, 1))

        while True:
            timer_start = time.perf_counter()

            await asyncio.gather(*self.api_request_list)

            timer_stop = time.perf_counter()
            print(f"Performed all requests in... {timer_stop - timer_start:0.4f} seconds")

    async def api_request(self, query, sleep_duration):
        await asyncio.sleep(sleep_duration)
        async with ClientSession() as session:
            async with session.get(self.PROMETHEUS_URL) as response:
            response = await response.text()
            random_int = int(response[2])
            print('Request response... {0}'.format(random_int))

if __name__ == '__main__':
    query …
Run Code Online (Sandbox Code Playgroud)

python asynchronous python-asyncio

1
推荐指数
1
解决办法
1万
查看次数

如何使用 Terraform 在 Ec2 实例中运行 Docker?

我想知道是否可以通过 Terraform apply 在 Ec2 实例中安装和运行 Docker 容器。

amazon-ec2 amazon-web-services docker terraform

0
推荐指数
1
解决办法
954
查看次数