`
zhangziyangup
  • 浏览: 1065716 次
文章分类
社区版块
存档分类
最新评论

在公司给资源池中的和不在项目组和有兴趣培训的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

<!--[if !supportLists]-->· <!--[endif]-->onCreate(Bundle)is where you initialize your activity. Most importantly, here you will usually callsetContentView(int)with a layout resource defining your UI, and usingfindViewById(int)to retrieve the widgets in that UI that you need to interact with programmatically.

<!--[if !supportLists]-->· <!--[endif]-->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 theContentProviderholding the data).

<!--[if !supportLists]-->· <!--[endif]-->

onActivityResult

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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics