How to implement a Button on an Android Widget

前端 未结 2 1952
别那么骄傲
别那么骄傲 2020-12-08 15:26

I am just getting started with Android development and I have created a nice little widget that displays some info on my home screen. However, I now want to implement a But

2条回答
  •  一个人的身影
    2020-12-08 16:13

    Button is supported in appwidget so not sure what the problem is. Look at this example on how assign actions via views.setOnClickPendingIntent(R.id.YOURVIEW ID, yourIntent);

    A RemoteViews object (and, consequently, an App Widget) can support the following layout classes:

    FrameLayout LinearLayout RelativeLayout

    And the following widget classes:

    AnalogClock Button Chronometer ImageButton ImageView ProgressBar TextView Descendants of these classes are not supported.

提交回复
热议问题