簡體   English   中英

在活動中顯示圖像按鈕

[英]Displaying ImageButtons in an Activity

我想顯示ImageButtons 喜歡在我的Android應用的活動。

現在,當我單擊任何一個ImageButton時,它應該啟動一個新的Activity。

我不知道這種觀點是否可行。

這會幫助你,

http://www.inter-fuser.com/2010/01/android-coverflow-widget.html

還有這個

http://stackoverflow.com/questions/5116825/android-circular-gallery-or-listview-with-zoom-in-and-out-option/5116945#5116945

謝謝。

您應該檢查Gallery小部件。

是的,這是可能的。像按鈕單擊監聽器一樣,圖像按鈕也有一個監聽器。

您可以嘗試以下代碼:-

ImageButton imageButton = new ImageButton(getApplicationContext());

    imageButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            Intent intent = new Intent("<activity_class_name or intent action");

            context.startActivity(intent);

        }
    });

暫無
暫無

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

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