zoukankan      html  css  js  c++  java
  • Android开发学习笔记

    java要点:一个文件只能有一个public类

    第一次启动模拟器后可以先设置语言和时区(时区是灰色的话把自动获取的钩去掉就能设置)

    工作环境:avd2.2

    1.手动在模拟器中安装和卸载应用程序(在Eclipse里的项目中选run as->android的话会自动安装到模拟器中)

    先把xxx.apk文件拷到adb.exe所在目录(这里是sdk中的platform-tools文件夹里)

    然后在cmd里cd到adb.exe所在目录,输入adb install xxx.apk,显示success则可以

    卸载方法一:到模拟器里选择设置->应用程序->管理应用程序->点击要卸载的应用程序

    卸载方法二:在cmd里输入adb uninstall package名称(package名称如下图所示,一般是com开头的那种)

    2.各控件笔记

    TextView

      android:id="@+id/tv" //添加id到R.java里,要用的时候只要findViewById(R.id.tv)就可以了

      android:autoLink  //设置连接地址,电话等为可点击的

      跑马灯效果:

    android:singleLine="true"
    android:ellipsize="marquee"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:marqueeRepeatLimit="marquee_forever"

    EditView(若不想第一次启动时自动获取焦点,可以建两个EditView,并把第一个的宽和高设置为0)

    也可以直接在EditView前插入如下代码

    <LinearLayout 
        android:id="@+id/linearLayout_focus" 
        android:focusable="true" 
        android:focusableInTouchMode="true" 
        android:layout_width="0px" 
        android:layout_height="0px">
    </LinearLayout> 

    3.解决 Android 软键盘弹出,破坏界面布局的问题

    让软键盘出现在Activity最上层,不把我原来的View挤到最上面
    在androidMainfest.xml文件中在此Activity中写入 android:windowSoftInputMode="adjustPan",就可以解决问题

     

    4.让android模拟器支持物理键盘

    添加上面两项:

        keyboard lid support: 模拟器物理键盘,设为yes,表示模拟器物理键盘可用;

        keyboard support : 电脑键盘,设为yes,电脑键盘可用。

    5. 9月16日android sdk2.3.3 安装小笔记

    下载 (全部绿色版):

    eclipse-jee-juno-win32-x86_64

    android-ndk-r8b-windows

    ADT-20.0.3(这个版本的adt包含了ndk组件,在手动安装前要先安装cdt才能装,否则要把该ndk组件前的钩剔除才能继续安装)

    android-sdk_r20.0.3-windows(环境变量ANDROID_SDK要新建在系统变量中,否则在cmd中打adb会not found)

    1、在SDK Manager下Tools->Options打开了SDK Manager的Settings,选中“Force https://… sources to be fetched using http://…”,强制使用http协议。
    2、修改host文件,添加下面两行

    #google_android更新
    203.208.46.146 dl.google.com
    203.208.46.146 dl-ssl.google.com

    另:
    windows修改host方法
    Windows打开C:\WINDOWS\system32\drivers\etc\hosts文件直接修改

    MAC更改host方法
    1、打开终端(terminal),输入:sudo vi /etc/hosts 
    2、输入系统密码 
    3、输入 i 进入编辑模式 
    4、编辑完成之后,按esc,输入 : wq 

    6.import引入项目时,要选general->existing projects into workspace, 如果项目出现错误

    之后对项目右键选properties->java compiler,  在右边的compiler compliance level选择1.6, 之后点apply

    7.sqlite3 not found问题解决方法

    用eclipse把从模拟器中取出的sqlite3文件放到/system/xbin中去

    设置权限: adb shell -> # chomd 4755 /system/xbin/sqlite3

    8.google play出现vending错误的解决办法:

    下载这个apk,用RE管理器直接覆盖掉system/app/下的同名文件,修改权限为211,重启即可了

    9.

  • 相关阅读:
    leetcode 18 4Sum
    leetcode 71 Simplify Path
    leetcode 10 Regular Expression Matching
    leetcode 30 Substring with Concatenation of All Words
    leetcode 355 Design Twitte
    leetcode LRU Cache
    leetcode 3Sum
    leetcode Letter Combinations of a Phone Number
    leetcode Remove Nth Node From End of List
    leetcode Valid Parentheses
  • 原文地址:https://www.cnblogs.com/tomboy/p/2572886.html
Copyright © 2011-2022 走看看