在android中,如何在單擊特定項目時始終使用第二個圖像(不是帶有兩個drawable的兩個圖像,而是僅帶有一個drawable在圖像繪製)編程。如何在GridView中的另一個ImageView上顯示圖像
任何幫助?謝謝
在android中,如何在單擊特定項目時始終使用第二個圖像(不是帶有兩個drawable的兩個圖像,而是僅帶有一個drawable在圖像繪製)編程。如何在GridView中的另一個ImageView上顯示圖像
任何幫助?謝謝
如果我理解你正確,你想能夠在另一張圖片上顯示圖片。您可以使用FrameLayout完成此操作。在你的網格視圖適配器中,膨脹並返回一個包含你的圖像的framelayout。讓其中一個圖像默認可見性=「隱藏」,並在點擊該項目時對其進行相應更改。
像這樣的東西應該幫助如果我明白你的要求以及
Resources r = getResources();
Drawable[] layers = new Drawable[2];
layers[0] = r.getDrawable(R.drawable.t);
layers[1] = r.getDrawable(R.drawable.tt);
LayerDrawable layerDrawable = new LayerDrawable(layers);
testimage.setImageDrawable(layerDrawable);
任何變通辦法?您是否嘗試遵循任何自定義的GridView示例? – 2015-02-24 11:33:08