我試圖將ImageDrawable顯示爲ImageButton圖像。所有圖層必須具有不同的最高值。如top += 10;
。爲此我用setLayerInset
繪製圖層項目,但它拉伸的圖像。我也嘗試了不同的參數,它只是顯示了其他愚蠢的佈局。具有LayerDrawable圖像的Android ImageButton
的setLayerInset嘗試後,我用InsetDrawable,給頂參數自己的構造:
new InsetDrawable(resources.getDrawable(R.drawable.soldier), 0, layerTop, 0, 0);
此時,頂部看起來不錯,但顯示的ImageButton它的一個非常小的區域。
基本佈局, 讓的說,這是我的形象,
*---* | | | | ---
佈局應該是,
*---* | | *---* | | *---* | | *---* | | | | ---