簡體   English   中英

在Android中繪制自定義可繪制

[英]draw custom drawable in android

如何繪制圖像中附加的自定義可繪制對象?

在此處輸入圖片說明

我沒有完整的代碼,僅執行我應該如何進行的步驟就足夠了,並且任何指向高級自定義可繪制教程的鏈接。 謝謝。

您可以通過使用9色塊圖像作為背景來實現。

這是一個不錯的工具,您可以在線使用簡單的九補丁生成器

這是您將如何實現的

  • 在主布局視圖中使用白色背景(例如,表格視圖)
  • 為灰色框創建兩個9色塊圖像。 一個用於左側,另一個用於右側
  • 對於必須呈灰色顯示的框,請使用適當的9路徑背景(左或右)。

我使用layer-list實現了它。 任何人都需要查看代碼。給我發消息。

<!-- Colored rectangle -->
<item>
    <shape android:shape="rectangle" >
        <stroke android:color="@color/color_black" />

        <solid android:color="@color/col_gray_light" />
    </shape>
</item>
<item
    android:bottom="50dp"
    android:left="-25dp"
    android:right="-105dp"
    android:top="-120dp">
    <rotate android:fromDegrees="45" >
        <shape android:shape="rectangle" >
            <solid android:color="@color/color_white" />
        </shape>
    </rotate>
</item>
<item
    android:bottom="63dp"
    android:right="-15dp"
    android:top="-40dp">
    <rotate android:fromDegrees="45" >
        <shape android:shape="rectangle" >
            <solid android:color="@color/color_white" />
        </shape>
    </rotate>
</item>
<item
    android:bottom="-40dp"
    android:right="-20dp"
    android:top="60dp">
    <rotate android:fromDegrees="-45" >
        <shape android:shape="rectangle" >
            <solid android:color="@color/color_white" />
        </shape>
    </rotate>
</item>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM