android实习程序6——拨号通话
2023-09-27 14:23:53 时间
拨号通话
ListView
GridView
AdapterView
在路径android-sdkr16\android-sdkr16\platform-tools确认存在adb.exe
下载youlu_android_1_2_7.youlu.apk
运行cmd
d:
cd D:\0701\android0701\android-sdkr16\android-sdkr16\platform-tools
adb install youlu_android_1_2_7.youlu.apk
安装adb.exe
D:\0701\android0701\android-sdkr16\android-sdkr16\docs\reference\android\widget
可看android的参考文档
Adapter的4个方法
getCount
getView
getItem
getItemId
D:\0701\android0701\android-sdkr16\android-sdkr16\tools
点开draw9patch.bat
完成图像的自由拉伸
如:call_log_type_item_bg_a.9.png
常志鹏
18046501727
changzp@tarena.com.cn
QQ群:326285800
拨号通话:
现完成的是键盘的设置
--------------------------------------------------------------
PhoneManager.java
package cpm.tarena.Phone;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
public class PhoneManagerActivity extends Activity {
//ImageButton mImagebutton_1,mImageButton_2,mImageButton_3,mImageButton_4,mImageButton_5,mImageButton_6,mImageButton_7,mImageButton_8,mImageButton_9,mImageButton_10,mImageButton_11,mImageButton_12;
ImageButton key_hide;
LinearLayout mLinearLayout;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mLinearLayout = (LinearLayout)findViewById(R.id.keyboard_layout);
key_hide = (ImageButton) findViewById(R.id.key_hide);
key_hide.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
mLinearLayout.setVisibility(View.GONE);
}
});
}
}
------------------------------------------------------------
main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/keyboard_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical"
android:background="#fcfcfc">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/keyboard_line_bg" >
<ImageButton
android:id="@+id/key_hide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="#0000"
android:src="@drawable/keyboard_hide" />
<ImageButton
android:id="@+id/key_del"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#0000"
android:src="@drawable/keyboard_backspace" />
<Button
android:id="@+id/call_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/key_del"
android:layout_toRightOf="@id/key_hide"
android:background="@drawable/dial_call_bg"
android:text="139111111"
android:textSize="18sp"
android:textColor="#fff"
android:ellipsize="start" />
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/key_1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/keyboard_1"
android:background="@drawable/key_bg_s"/>
<ImageButton
android:id="@+id/key_2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/keyboard_2"
android:background="@drawable/key_bg_s"/>
<ImageButton
android:id="@+id/key_3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/keyboard_3"
android:background="@drawable/key_bg_s"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/key_4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/keyboard_4"
android:background="@drawable/key_bg_s"/>
<ImageButton
android:id="@+id/key_5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/keyboard_5"
android:background="@drawable/key_bg_s"/>
<ImageButton
android:id="@+id/key_6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/keyboard_6"
android:background="@drawable/key_bg_s"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/key_7"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/keyboard_7"
android:background="@drawable/key_bg_s"/>
<ImageButton
android:id="@+id/key_8"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/keyboard_8"
android:background="@drawable/key_bg_s"/>
<ImageButton
android:id="@+id/key_9"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/keyboard_9"
android:background="@drawable/key_bg_s"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/key_jin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/keyboard_hash"
android:background="@drawable/key_bg_s"/>
<ImageButton
android:id="@+id/key_0"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/keyboard_0"
android:background="@drawable/key_bg_s"/>
<ImageButton
android:id="@+id/key_xin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/keyboard_star"
android:background="@drawable/key_bg_s"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
-----------------------------------------------------
在res下新建文件夹drawable
在该文件下,新建selector
命名key_bg_s
(实现按键时,改变按键的颜色)
实现方法为设置背景时,设置为key_bg_s
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/key_bg_a"
android:state_pressed="true"/>
<item
android:drawable="@drawable/key_bg"/>
</selector>
注意:严格的要求在上面
实现的效果为:
相关文章
- Android APK程序的smali动态调试
- Android NDK 环境搭建
- Android摄像头採集的视频数据流怎样通过Socket实时发送到目标服务端
- 被后台杀死后,Android应用如何重新走闪屏逻辑
- Xamarin Android真机测试报错
- Android弹幕功能实现,模仿斗鱼直播的弹幕效果
- 《Android 应用案例开发大全(第二版)》——6.7节获取第三方程序中可调用的窗口
- 《Android安全技术揭秘与防范》—第1章1.3节Android和iOS系统对比
- 《Android游戏开发详解》一2.15 改进程序
- 《Java和Android开发学习指南(第2版)》——第1章,第1.2节第一个Java程序
- 《精通Android 5 多媒体开发》——第22章,第22.1节屏幕保护程序介绍
- 《精通移动App测试实战:技术、工具和案例》一1.7 创建一个Android项目
- 《Android游戏开发详解》——第2章,第2.7节构建一个简单的计数程序
- 《Android游戏开发详解》一2.4 执行Java程序
- 《Android游戏开发详解》一2.6 构建一个简单的计算器程序
- 《Android游戏开发详解》一2.7 构建一个简单的计数程序
- Android开发中内置apk程序
- Android Task 与 Back Stack
- android中 检查网络连接状态的变化,无网络时跳转到设置界面
- android 弹出框(输入框和选择框)
- android.intent.action.MAIN 与 android.intent.category.LAUNCHER 的验证理解
- 高德地图Demo运行报错 com.android.ide.common.process.ProcessException: Failed to execute aapt
- Android程序的测试方法
- 学习Android之第六个小程序新浪微博(二)(ListView和TabActivity)
- 【Android】应用安全——反编译
- 教我兄弟学Android逆向02 破解第一个Android程序
- 教我兄弟学Android逆向01 编写第一个Android程序
- Android UncaughtExceptionHandler 记录异常并重启程序
- Android Bluetooth 蓝牙强度Rssi
- Android Studio 添加代码块自动补全