在公司给资源池中的和不在项目组和有兴趣培训的android资料_第二课

应用重在积累

 

键盘截获事件

事件:

onKeyMultipleonTouchEventonKeyDownonKeyUponKeyLongPressonBackPressed

截获:

KeyEvent.KEYCODE_MENUKeyEvent.KEYCODE_BACKKeyEvent.KEYCODE_0

KeyEvent.KEYCODE_DPAD_CENTERKeyEvent.KEYCODE_DPAD_DOWN

KeyEvent.KEYCODE_DPAD_LEFTKeyEvent.KEYCODE_DPAD_RIGHT

KeyEvent.KEYCODE_DPAD_UPKeyEvent.KEYCODE_ALT_LEFT

MotionEvent.ACTION_MOVE

 

ToastDialogPopupWindow区别:共同点都可以加载布局,不同点是否可以获取焦点、是否可以自定义位置。

 

Dialog android自带实例:com.example.android.apis.app. AlertDialogSamples

 

Toast : 方式一加载布局(下面红色为加载布局方式)

LayoutInflater layoutInflater = getLayoutInflater();

                  layoutView = (LinearLayout) layoutInflater.inflate(

                         R.layout.toast,

                         (ViewGroup) findViewById(R.id.toast_area));

                  toast = new Toast(getApplicationContext());     

                  toast.setView(layoutView);

                  toast.show();

方式二简单提示:Toast.makeText(this, "This checkbox is: unchecked",

                     Toast.LENGTH_SHORT).show();

 

布局中拆分布局:<include layout="@layout/*** " />

针对性的布局或组件隐藏:android:visibility="gone"

                        代码控制setVisibility(View.VISIBLE/GONE/ INVISIBLE/GONE);

字体的HTML格式式处理:Html.fromHtml("<u>添加抄送</u>")

ScrollView:注意点:不能在之内包含ListView因为它本身也包含了、其次一定别忘了是先加载布局后在次布局上加载组件。

 

五大布局:

Android有五大布局对象,它们分别是FrameLayout【遮蔽】,LinearLayout【线性布局setOrientation(int) /android:orientation=” horizontal / vertical”注意:好多属性有相应的对应的方法】,RelativeLayout【相对布局】,

TableLayoutandroid自带实例:com.example.android.apis.view. Tabs3

AbsoluteLayouxy0点坐标为左上角,绝对布局[android:layout_y="10px"android:layout_x="110px"]

 

Acivity生命周期注意点:

file:///D:/android_sdk/android-sdk-windows/docs/reference/android/app/Activity.html

·                                 onCreate(Bundle) is where you initialize your activity. Most importantly, here you will usually callsetContentView(int) with a layout resource defining your UI, and using findViewById(int) to retrieve the widgets in that UI that you need to interact with programmatically.

·                                 onPause() is where you deal with the user leaving your activity. Most importantly, any changes made by the user should at this point be committed (usually to the ContentProvider holding the data).

·                                  

onActivityResult

一些常用方法:setTitle(CharSequence title)等等,需要熟悉Activity这个类,这个是与用户交互的所以需要认真认识这个类提供了哪些常用方法。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值