是否可以为应用程序中的所有ImageView设置背景样式

时间:2018-08-06 09:15:21

标签: android

我知道我可以创建一些样式并像这样设置它。

.method private compressAndFormat([B)J
    .locals 10
    .param p1, "tokenData"    # [B

    .prologue
    const/4 v9, 0x1

    .line 641
    const-wide/16 v3, 0x0

    .line 643
    .local v3, "result":J
    const/4 v1, 0x0

    .line 644
    .local v1, "i":I
    :goto_0
    :try_start_0
    iget-object v7, p0, Lcom/fancyfon/onmobile/signature/OnMobileSignatureToken;->ipb:[B

    array-length v7, v7

    if-ge v1, v7, :cond_3

    .line 645
    const/16 v0, 0x8

    .line 646
    .local v0, "bit":I
    :goto_1
    if-ltz v0, :cond_2

    .line 647
    shl-int v7, v9, v0

    int-to-byte v2, v7

    .line 648
    .local v2, "mask":B
    iget-object v7, p0, Lcom/fancyfon/onmobile/signature/OnMobileSignatureToken;->ipb:[B

    aget-byte v7, v7, v1

    and-int/2addr v7, v2

    if-eqz v7, :cond_1

    .line 649
    aget-byte v7, p1, v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    and-int/2addr v7, v2

    if-eqz v7, :cond_0

    .line 650
    const-wide/16 v7, 0x1

    or-long/2addr v3, v7

    .line 652
    :cond_0
    shl-long/2addr v3, v9

    .line 646
    :cond_1
    add-int/lit8 v0, v0, -0x1

    goto :goto_1

    .line 644
    .end local v2    # "mask":B
    :cond_2
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 656
    .end local v0    # "bit":I
    :cond_3
    shr-long/2addr v3, v9

    .line 659
    const-wide/16 v5, 0x0

    .end local v3    # "result":J
    .local v5, "result":J
    return-wide v3

    .end local v5    # "result":J
    .restart local v3    # "result":J
    :catchall_0
    move-exception v7

    const-wide/16 v3, 0x0

    throw v7
.end method

但是我找不到机会直接为整个应用程序将其设置为默认样式,例如TextView。

<ImageView
        style="@style/MyCustomStyle" />

我也找不到父ImageView wiget样式。

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:textViewStyle">@style/CustomTextStyle</item>
</style>

ImageView是否可能。

1 个答案:

答案 0 :(得分:2)

您宁愿创建一个自定义ImageView并为其添加样式。然后使用CustomImageView,它在整个应用程序中将具有相同的样式