widget on lockscreen

送分小仙女□ 提交于 2019-12-11 07:44:37

问题


I have read post here and also search for it, but haven't found answer. Is it possible add widget to lockscreen? I need it for music player control. Is there some way or only way is to create own lockscreen with lock, unlock implementation? I tried custom activity but it's displayed over the lockscreen and unlock is not visible until i press back and activity is closed.

Thanks, vandzi


回答1:


Solution for music player control on lockscreen is RemoteControlClient




回答2:


Are you looking to make a widget for the lockscreen or do you want to put a premade widget onto the lockscreen? As far as I know, using the settings, you cannot put a widget onto the lockscreen. Only apps.




回答3:


I create the compass on lockscreen like this :

add the widgetview in you keyguard_screen_tab_unlock.xml; it's on 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" />`

`

and then find it on you LockScreen.jave . it's on frameword/base/policy

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);

and make you code , push it in you phone and reboot it



来源:https://stackoverflow.com/questions/11952347/widget-on-lockscreen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!