简体   繁体   中英

widget on lockscreen

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

锁定屏幕上音乐播放器控件的解决方案是RemoteControlClient

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM