`
weiwei5910
  • 浏览: 26778 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类

android边学边记——Demo_phone

阅读更多
学到了第二课 做一个简单的拔号器 发现在Eclipse中打的中文字都好小
于是继续百度Google 找到解决方法如下

最近新装了Win7,打开eclipse3.7中文字体很小,简直难以辨认。在网上搜索发现这是由于Eclipse 3.7 用的字体是 Consolas,显示中文的时候默认太小了。
    解决方式有两种:
一、把字体设置为Courier New
操作步骤:打开Elcipse,点击菜单栏上的“Windows”——点击“Preferences”——点击“Genneral”——点击“Appearance”——点击“Colors and Font”——在右侧框展开“Basic”文件夹--双击“Text Font”——在弹出窗选择“Courier New”(注:这里可能找不到“Courier New”,点击字体选择框左下角的“显示更多字体”链接来打开设置字体的控制面板,找到“Courier New”,右键选择“显示”即可激活该字体)——点击按钮“确定”——点击按钮“OK”,完成。
二、使用混合字体代替Consolas字体。
  操作步骤:
1.下载Consolas和微软雅黑混合字体(地址:http://files.cnblogs.com/icelyb24/YaHei.Consolas.1.12.rar)
2.解压之后,把YaHei.Consolas.1.12.ttfw文件复制到C:\Windows\Fonts目录下,完成字体的安装
3.打开Elcipse,点击菜单栏上的“Windows”——点击“Preferences”——点击“Genneral”——点击“Appearance”——点击“Colors and Font”——在右侧框展开“Basic”文件夹--双击“Text Font”——在弹出窗选择“YaHei.Consolas”——点击按钮“确定”——点击按钮“OK”,完成。



package com.wei.activity;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class Demo_phoneActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        /*
         * 能过id得到组件  
         */
        Button btn_call = (Button)this.findViewById(R.id.btn_call);
        btn_call.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View arg0) {
				EditText edit_phoneNum = (EditText) findViewById(R.id.edit_phoneNum);
				String phoneNum = edit_phoneNum.getText().toString();
				if(phoneNum != null && !phoneNum.trim().equals("")){
					/*
					 * 创建一个拨打电话的意图  参数 Intent.ACTION_CALL 表示调用电话拨号器 
					 * Uri.parse("tel:"+phoneNum) 这个类似于一个URL地址
					 * 前缀"tel:"不能写错
					 */
					Intent intent_call = new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+phoneNum));
					startActivity(intent_call);
				}
			}
		});
        
        
    }
}


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.wei.activity"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" />
	<!-- 向系统申请拨号器权限 -->
    <uses-permission android:name="android.permission.CALL_PHONE" />
    
    <application
        android:icon="@drawable/my_icon"
        android:label="@string/app_name" >
        <activity
            android:name=".Demo_phoneActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
	
</manifest>
1
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics