2016-07-29 62 views
-1

自定形狀我想畫一個自定義形狀像這樣繪製在android系統

enter image description here

我試圖用它作爲TextView的,但它使我由於箭頭旁邊的底部藍色部分有點擊的問題被認爲是圖像的一部分..所以我想我的形狀只是白色和橙色部分 我應該如何繪製這樣的形狀?通過代碼或XML不要期待完整的代碼,只要給我想法或指向正確的方向。

+0

你可以然後將白色部分作爲圖像,整個ImageView矩形將可點擊。 – Shaishav

+0

您可以製作自定義視圖。 –

+0

您可以使用像草圖這樣的矢量編輯器,矢量是創建自定義形狀的好方法。 –

回答

2

我解決了點擊問題通過裁剪原始圖像以兩個形狀 然後在XML粘合在一起並添加監聽器上textviews僅丟棄底部藍色部分

enter image description here

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center"> 

    <TextView 
     android:id="@+id/explore_rectangle_txt" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@drawable/explore_rectangle" 
     /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/explore_rectangle_txt" 
     android:background="@drawable/explore_arrow" 
     /> 
</RelativeLayout> 
+0

有類似的問題,你的答案幫助了我。謝謝 – Sarah