Android学习笔记二

1. drawable- hdpi、drawable- mdpi、drawable-ldpi的区别:

  (1)drawable-hdpi里面存放高分辨率的图片,如WVGA (480x800),FWVGA (480x854)

  (2)drawable-mdpi里面存放中等分辨率的图片,如HVGA (320x480)

  (3)drawable-ldpi里面存放低分辨率的图片,如QVGA (240x320)

  系统会根据机器的分辨率来分别到这几个文件夹里面去找对应的图片。

在开发程序时为了兼容不同平台不同屏幕,建议各自文件夹根据需求均存放不同版本图片。

 


2. 布局时padding为内嵌的,layout_margin为外层。如果加入背景可以发现区别。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#FF909090" android:paddingRight="13.0dip" android:text="xxxxxxxx" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#FF909090" android:paddingLeft="13.0dip" android:text="xxxxxxxx" /> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="13.0dip" android:background="#FF909090" android:text="xxxxxxxx" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="13.0dip" android:background="#FF909090" android:text="xxxxxxxx" /> </LinearLayout> 

 

3. 解决 Android 模拟器 无法上网问题

 

1)   androidtool增加到,windows 环境变量 path中, D:/Android/android-sdk_r3-windows/android-sdk-windows/tools/

 

2) 启动 android 模拟器,启动方式有两种。

 

第一种方式:在window上打开命令行窗口(快捷键:windows+R) 输入 cmd下输入:emulator -avd <youravdname>

 

第二种方式,就是直接在eclipseAndroid工程上,点击鼠标右键,选择 Run as-> Android Application,运行工程。


 

3) window上,打开命令行窗口,输入 adb shell 命令。该命令是进入模拟器的linux系统。

 

4)  adb shell 模式下执行以下命令 

sqlite3 /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO system VALUES(99,'http_proxy','
10.10.26.252:1080')"


 

5)  adb shell 模式下执行查询命令可以看到新插入的信息

sqlite3 /data/data/com.android.providers.settings/databases/settings.db "SELECT * FROM system"

 

 

6) 重新启动Android模拟器,程序可以登录http网站。

备注:

删除刚刚写入的配置信息方法:

sqlite3 /data/data/com.android.providers.settings/databases/settings.db "DELETE FROM system WHERE _id=99"

 


你可能感兴趣的:(windows,android,sqlite,shell,layout,System)