当前位置: 编程技术>移动开发
本页文章导读:
▪启动模拟器的有关问题 启动模拟器的问题
在我前面的文章中,写了关于如果启动Android源码编译出来的模拟器的问题,如果在编译SDK之前启动模拟器,是没有问题的,当编译了SDK,再启动模拟器就会报.........
▪ 编撰App的开场Activity 编写App的开场Activity
在android的app和游戏的应用中,都会有个开场场景,老外管这个叫splash。现在就编写个简单的SplashActivity
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle.........
▪ 简略的pickView实现 简单的pickView实现
h文件代码
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
<UIPickerViewDelegate,UIPickerViewDataSource>
{
UILabel *fontLabel;
UIPickerView *fontPickView;
NSArray *fonts;
}
@.........
[1]启动模拟器的有关问题
来源: 互联网 发布时间: 2014-02-18
启动模拟器的问题
在我前面的文章中,写了关于如果启动Android源码编译出来的模拟器的问题,如果在编译SDK之前启动模拟器,是没有问题的,当编译了SDK,再启动模拟器就会报这样的问题:
ERROR: You did not specify a virtual device name, and the system
directory could not be found.
If you are an Android SDK user, please use '@<name>' or '-avd <name>'
to start a given virtual device (see -help-avd for details).
Otherwise, follow the instructions in -help-disk-images to start the emulator
在网上寻求答案,有的说没有avd,好吧,那我添加avd,当进入到tools目录下使用 android工具又报错:
SWT folder '/home/archermind/source/source/out/host/linux-x86/framework/x86_64' does not exist.
Please export ANDROID_SWT to point to the folder containing swt.jar for your platform.
跟着解决:
export ANDROID_SWT=/home/archermind/source/source/out/host/linux-x86/framework
接着使用 /$ android 命令,接着报错:
/$ android
Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
at com.android.sdkmanager.Main.showSdkManagerWindow(Main.java:319)
at com.android.sdkmanager.Main.doAction(Main.java:307)
at com.android.sdkmanager.Main.run(Main.java:116)
at com.android.sdkmanager.Main.main(Main.java:99)
接着查错,发现净是些关于eclipse的问题,所以我重新整理了一下,看问题的可能所在,看一下大的操作步骤:
1. make ----- 编译Android源代码
(编译好了后,先 . /build/envsetup.sh 之后再启动模拟器没有问题)
2.lunch sdk-eng ----- 指定版本
3.make sdk ------ 编译sdk
(模拟器启动不了了,报错信息看上文)
所以问题处在2 ,3 步骤,重新make之后还是存在这样的问题,最终,在make前指定版本 ,执行 lunch sdk-eng ,再执行make,这样模拟器就可以使用了。
在我前面的文章中,写了关于如果启动Android源码编译出来的模拟器的问题,如果在编译SDK之前启动模拟器,是没有问题的,当编译了SDK,再启动模拟器就会报这样的问题:
ERROR: You did not specify a virtual device name, and the system
directory could not be found.
If you are an Android SDK user, please use '@<name>' or '-avd <name>'
to start a given virtual device (see -help-avd for details).
Otherwise, follow the instructions in -help-disk-images to start the emulator
在网上寻求答案,有的说没有avd,好吧,那我添加avd,当进入到tools目录下使用 android工具又报错:
SWT folder '/home/archermind/source/source/out/host/linux-x86/framework/x86_64' does not exist.
Please export ANDROID_SWT to point to the folder containing swt.jar for your platform.
跟着解决:
export ANDROID_SWT=/home/archermind/source/source/out/host/linux-x86/framework
接着使用 /$ android 命令,接着报错:
/$ android
Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
at com.android.sdkmanager.Main.showSdkManagerWindow(Main.java:319)
at com.android.sdkmanager.Main.doAction(Main.java:307)
at com.android.sdkmanager.Main.run(Main.java:116)
at com.android.sdkmanager.Main.main(Main.java:99)
接着查错,发现净是些关于eclipse的问题,所以我重新整理了一下,看问题的可能所在,看一下大的操作步骤:
1. make ----- 编译Android源代码
(编译好了后,先 . /build/envsetup.sh 之后再启动模拟器没有问题)
2.lunch sdk-eng ----- 指定版本
3.make sdk ------ 编译sdk
(模拟器启动不了了,报错信息看上文)
所以问题处在2 ,3 步骤,重新make之后还是存在这样的问题,最终,在make前指定版本 ,执行 lunch sdk-eng ,再执行make,这样模拟器就可以使用了。
[2] 编撰App的开场Activity
来源: 互联网 发布时间: 2014-02-18
编写App的开场Activity
在android的app和游戏的应用中,都会有个开场场景,老外管这个叫splash。
现在就编写个简单的SplashActivity
下面是splash.xml,layout 文件了
在android的app和游戏的应用中,都会有个开场场景,老外管这个叫splash。
现在就编写个简单的SplashActivity
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
public class SplashActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
ImageView splashImg = (ImageView) findViewById(R.id.splash_image);
splashImg.postDelayed(new Runnable() {//这里利用了View的postDelayed
public void run() {
Intent intent = new Intent();
intent.setClass(SplashActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
}, 1000);
}
}
下面是splash.xml,layout 文件了
<?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" >
<ImageView
android:id="@+id/splash_background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:scaleType="fitXY"
android:src="/blog_article/@drawable/splash_floor/index.html" />
<ImageView
android:id="@+id/splash_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:scaleType="fitXY"
android:src="/blog_article/@drawable/splash_logo/index.html" />
<ImageView
android:id="@+id/splash_foot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10.0dip"
android:src="/blog_article/@drawable/splash_logo_foot/index.html" />
</RelativeLayout>
[3] 简略的pickView实现
来源: 互联网 发布时间: 2014-02-18
简单的pickView实现
h文件代码
h文件代码
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
<UIPickerViewDelegate,UIPickerViewDataSource>
{
UILabel *fontLabel;
UIPickerView *fontPickView;
NSArray *fonts;
}
@property (nonatomic ,retain)
IBOutlet UILabel *fontLabel;
@property (nonatomic,retain)
IBOutlet UIPickerView *fontPickView;
@end
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize fontLabel;
@synthesize fontPickView;
- (void)viewDidLoad
{
[super viewDidLoad];
fonts = [UIFont familyNames];
fontPickView.dataSource = self;
fontPickView.delegate = self;
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/* 返回列数*/
-(NSInteger) numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;}
/*返回行数
*/
-(NSInteger) pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
return [fonts count];
}
/*返回某行某列的值*/
-(NSString *) pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return [fonts objectAtIndex:row];
}
/*返回某行某列选中的事件*/
-(void) pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
NSString *sfont = [fonts objectAtIndex:row];
fontLabel.font = [UIFont fontWithName:sfont size:20.0f];
fontLabel.text =sfont;
}
@end
最新技术文章: