【问题标题】:widget on lockscreen锁屏上的小部件
【发布时间】:2012-08-14 12:32:13
【问题描述】:

我已阅读此处的帖子并搜索它,但没有找到答案。 是否可以将小部件添加到锁屏?我需要它来控制音乐播放器。 有没有办法或唯一的方法是创建自己的锁屏,解锁实现? 我尝试了自定义活动,但它显示在锁定屏幕上,并且在我按回并关闭活动之前,解锁不可见。

谢谢, 万兹

【问题讨论】:

    标签: android android-widget


    【解决方案1】:

    锁屏音乐播放器控制解决方案是RemoteControlClient

    【讨论】:

      【解决方案2】:

      您是要为锁屏制作一个小部件,还是要在锁屏上放置一个预制小部件?据我所知,使用设置,您无法将小部件放到锁屏上。仅限应用。

      【讨论】:

      • 我希望将媒体播放器控件放在屏幕上,以便用户可以在锁定屏幕上控制播放器。我在一些播客应用中看到了它。
      【解决方案3】:

      我像这样在锁屏上创建指南针:

      在 keyguard_screen_tab_unlock.xml 中添加小部件视图;它在 framework/base/core/res/res/layout 上

       <com.android.internal.policy.widget.CompassW6000widgetView
                      android:id="@+id/compassWidget"
                      android:layout_width="320dip"
                      android:layout_height="340dip"
                      android:layout_below="@id/carrier"
                      android:center_x="98"
                      android:center_y="78"
                      android:compassImage="@drawable/widget_pointer"
                      android:compassbg0Image="@drawable/widget_blackground0"
                      android:compassbgImage="@drawable/widget_blackground"
                      android:compasscenterImage="@drawable/widget_center"
                      android:degress_str_x="157"
                      android:degress_str_y="148"
                      android:offsety="-5"
                      android:pause_action="android.intent.action.SCREEN_OFF"
                      android:relative_top_y="10"
                      android:resume_action="android.intent.action.SCREEN_ON"
                      android:rotate_type="center"
                      android:showtype="2" />`
      

      `

      然后在 LockScreen.jave 上找到它。它在框架字/基础/政策上

      CompassW6000widgetView mCompassView;
      final LayoutInflater inflater = LayoutInflater.from(context);
      
          if (true) {
              inflater.inflate(R.layout.keyguard_screen_tab_unlock, this, true);
      
          } 
      mUnlockWidget = findViewById(R.id.unlock_widget);
      

      让你编码,把它推到你的手机里并重启它

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-09-27
      • 2023-01-26
      • 2012-06-12
      • 2017-10-22
      • 1970-01-01
      • 2022-11-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多