Android 4.0 解锁界面有多种,可以在Settings中“安全”,“屏幕设定”中设置,默认滑动当触屏时左边显示拍照功能图标,右边显示解锁图标。其它几种“无”,“图案”,“密码”原理一样的可以去顺藤摸瓜。我对4.0还是出认识,有些地方不正确喜欢高人指正。后面几种布局文件修改后续推出。
锁屏java类frameworks/base/policy/src/com/android/internal/policy/impl/LockScreen.java中的构造函数可以看到一段代码
finalLayoutInflater inflater = LayoutInflater.from(context);
if (DBG) Log.v(TAG, "Creation orientation = " +mCreationOrientation);
if (mCreationOrientation != Configuration.ORIENTATION_LANDSCAPE) {
inflater.inflate(R.layout.keyguard_screen_tab_unlock, this, true);
}else {
inflater.inflate(R.layout.keyguard_screen_tab_unlock_land, this, true);
}
是当前页面横竖屏布局文件。
滑动布局文件在frameworks/base/core/res/res/layout/keyguard_screen_tab_unlock_land.xml(keyguard_screen_tab_unlock.xml)两个布局是针对横竖屏的。在这个布局文件中找到
<!-- Column 2 -->
<com.android.internal.widget.multiwaveview.MultiWaveView
android:id="@+id/unlock_widget"
android:layout_width="200dip"
android:layout_height="match_parent"
android:layout_rowSpan="7"
android:targetDrawables="@array/lockscreen_targets_with_camera"
android:targetDescriptions="@array/lockscreen_target_descriptions_with_camera"
android:directionDescriptions="@array/lockscreen_direction_descriptions"
android:handleDrawable="@drawable/ic_lockscreen_handle"
android:waveDrawable="@drawable/ic_lockscreen_outerring"
android:outerRadius="@dimen/multiwaveview_target_placement_radius"
android:snapMargin="@dimen/multiwaveview_snap_margin"
android:hitRadius="@dimen/multiwaveview_hit_radius"
android:topChevronDrawable="@drawable/ic_lockscreen_chevron_up"
android:feedbackCount="3"
android:vibrationDuration="20"
android:horizontalOffset="0dip"
android:verticalOffset="0dip"
/>
该布局在frameworks/base/core/java/com/android/internal/widget/multiwaveview下改文件下主要是做了一些图片动画,图片状态还有就是事件操作。
android:targetDrawables="@array/lockscreen_targets_with_camera"可以查看arrays.xml文件
frameworks/base/core/res/res/values/arrays.xml根据
<array name="lockscreen_targets_with_camera">
<item>@drawable/ic_lockscreen_unlock</item>
<item>@null</item>
<item>@drawable/ic_lockscreen_camera</item>
<item>@null</item>
</array>找到drawable文件夹下的配置文件ic_lockscreen_unlock,ic_lockscreen_camera两个配置文件就可以找到相应的UI图片,对其进行图片的修改就很容易了。