1,创建如下新文件
froyo\frameworks\base\core\res\res\layout\control_panel.xml 代码如下
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2006 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
This is the basic layout for a screen, with all of its features enabled.
-->
<!-- Title bar and content -->
<com.android.server.status.SystemMenuBarView xmlns:android="http://schemas.android.com/apk/res/android"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
>
<!-- Title bar -->
<ImageView android:id="@+id/panel1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/panel_back"
android:padding="2dip"
/>
<ImageView android:id="@+id/panel2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/panel_search"
android:padding="2dip"
/>
<ImageView android:id="@+id/panel3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/panel_menu"
android:padding="2dip"
/>
<ImageView android:id="@+id/panel4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/panel_home"
android:padding="2dip"
/>
</com.android.server.status.SystemMenuBarView>
另外 添加布局文件对应的图片资源文件,分竖屏和横屏
froyo\frameworks\base\services\java\com\android\server\status\SystemMenuBarView.java 代码如下
package com.android.server.status;
import android.content.Context;
import android.content.res.Configuration;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.android.internal.R;
public class SystemMenuBarView extends LinearLayout {
private Context mContext;
private int mOrientation = -1;
private int mCount = 0;
private ImageView iv1, iv2, iv3, iv4;
public SystemMenuBarView(Context context) {
super(context);
// TODO Auto-generated constructor stub
this.mContext = context;
}
public SystemMenuBarView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
iv1 = (ImageView)findViewById(R.id.panel1);
iv2 = (ImageView)findViewById(R.id.panel2);
iv3 = (ImageView)findViewById(R.id.panel3);
iv4 = (ImageView)findViewById(R.id.panel4);
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
// TODO Auto-generated method stub
if (mOrientation != newConfig.orientation){
//Log.i("orie", "mCount:" + mCount++ + " mOrientation: " + mOrientation + " newConfig.orientation: " + newConfig.orientation);
mOrientation = newConfig.orientation;
if (newConfig.orientation==Configuration.ORIENTATION_LANDSCAPE){
Log.i("orie", "land");
setOrientation(LinearLayout.VERTICAL);
iv1.setImageResource(R.drawable.panel_back);
iv2.setImageResource(R.drawable.panel_search);
iv3.setImageResource(R.drawable.panel_menu);
iv4.setImageResource(R.drawable.panel_home);
}else{
Log.i("orie", "port");
setOrientation(LinearLayout.HORIZONTAL);
iv1.setImageResource(R.drawable.panel_home);
iv2.setImageResource(R.drawable.panel_menu);
iv3.setImageResource(R.drawable.panel_search);
iv4.setImageResource(R.drawable.panel_back);
}
}
Log.i("orie", "executed");
super.onConfigurationChanged(newConfig);
}
}
分享到:
相关推荐
我们可以通过创建一个继承自`List<T>`的派生类,并在其中添加事件来实现事件功能。例如,我们可以定义一个`ObservableList<T>`类,包含`CollectionChanged`事件: ```csharp public class ObservableList<T> : List...
<Annotation type="notes">My virtual machine notes</Annotation> <OperatingSystemSection ovf:required="false" xmlns:ovf=...
<br>说明很多<br>记住一个万能的命令基本就够用了。<br>jad -sjava -r -8 -o **\*.class <br><br>---------------<br>This is README file for Jad - the fast Java Decompiler.<br>Jad home page: ...
第1章 PE文件格式深入研究<br/><br/>1.1 PE文件格式格式纵览<br/><br/> 1.1.1 区块(Section)<br/><br/> 1.1.2 相对虚拟地址(Relative Virtual Addresses)<br/><br/> 1.1.3 数据目录<br/><br/> 1.1.4 输入函数...
第1章 PE文件格式深入研究<br/><br/>1.1 PE文件格式格式纵览<br/><br/> 1.1.1 区块(Section)<br/><br/> 1.1.2 相对虚拟地址(Relative Virtual Addresses)<br/><br/> 1.1.3 数据目录<br/><br/> 1.1.4 输入函数...
看好在下:<br>第一章 CGI <br>第二章 ACTIVEX<br>第三章:异常处理<br>第四章 多线程/多进程<br>……<br>……<br>1.1 如何编写CGI程序<br><br>CGI的工作原理介绍:CGI(Common Gateway Interface)是一个WEB服务器...
and Open Shortest Path First(OSPF)<br>第七章:Layer 2 Switching<br>第八章:Virtual LANs(VLANs)<br>第九章:Managing a Cisco Interwork<br>第十章:Managing Traffic with Access Lists<br>第十一章:...
249<br>4-2 移动装置的Java Virtual Machine - KVM(K Virtual Machine) 250<br>4-2-1 KVM 的由来 250<br>4-2-2 KVM 移植技术 256<br>4-2-3 KVM 验证 262<br>4-2-4 小结 266<br>4-3 移动设备上的开发套件-MIDP 267...
and Open Shortest Path First(OSPF)<br>第七章:Layer 2 Switching<br>第八章:Virtual LANs(VLANs)<br>第九章:Managing a Cisco Interwork<br>第十章:Managing Traffic with Access Lists<br>第十一章:Wide ...
<br> 用C/C++语言写一函数完成该算法,给出复杂度<br><br>6.对序列1、1、2、3、5、8、13。。。。 是Fab..数列<br> 2、3、5、13...是Fab..质数数列,因为他们与自己前面的Fab...数列都互质<br>给出k,返回第k小的...
<br><br>4.A byte can be of what size<br>1)-128 to 127<br>2)(-2 power 8)-1 to 2 power 8<br>3)-255 to 256<br>4)depends on the particular implementation of the java virtual machine<br><br>5.哪些是Java...
<br>}<br><br>class TestCompImpl :TestComp<br>{<br> public virtual void DoSomething()<br> {<br> …<br>}<br>}<br><br>class TestCompCreator : BOS.Creator_<TestComp><br>{<br> public virtual TestComp Do...
and Open Shortest Path First(OSPF)<br>第七章:Layer 2 Switching<br>第八章:Virtual LANs(VLANs)<br>第九章:Managing a Cisco Interwork<br>第十章:Managing Traffic with Access Lists<br>第十一章:Wide ...
:9787113052416 <br>字数 :989千字 <br>印张 :41.75 <br>印数 :1-5000 <br>页数 :654 <br>开本 :787*1092 1/16 <br>版别版次:2003年7月第一版第一次印刷 <br>内容简介: <br>本书特色 <br>层次清晰、...
WebRun<br> | ------bin, WebRun程序及其所使用的组件的本目录<br> |-------etc, WebRun的配置文件目录<br> |-------webapp, WebRun默认的应用程序目录<br><br>官方网站: http://www.sinoprise.cn/<br>另一个下载...
不要紧,因为这两个文件一般不需要改动,直接用我编译好的目标文件就可以了<br><br>双击minios.dsw打开vc6,点击菜单Project->Project Setting->Debug,修改Executable for debug session一栏<br>将Virtual PC.exe的...
<br>一级(100元/天)<br>二级(70元/天)<br>三级(40元/天)<br>房间级别<br>**************8<br><br>头文件中<br>// Generated message map functions<br>//{{AFX_MSG(CMAINTAINDLG)<br>afx_msg void OnNext();...
<br><br><br><br><br><br>三、使用压缩包的测试程序,按钮二能提供的效果如下图:<br><br><br>图一 Word报表效果屏幕截图<br><br><br><br>四、说明:<br>开发环境为:vc6 + sp6 + xp_sdk<br>Word版本:2003企业版<br...
(305KB)<END><br>41,5287.exe<br>Pooling in the Microsoft Data Access Components(108KB)<END><br>42,virtual_dblist.zip<br>Using a Virtual CListView with a Dynaset(53KB)<END><br>43,dao_multithreading.zip...