android开发的几个注意事项
android 开发中 Activity主入口中尽量不要使用网络连接
在2.3.3版本前是不可以正常引入
新建android的 xml表现风格 时要注意布局
<?xml version="1.0" encoding="utf-8"?>
<!-- 最外层界面布局是RelativeLayout -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/newsdetail_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffffff"
>
<!--
标题栏用RelativeLayout,包含一个向前查看按钮、向后查看按钮
一个TextView, 一个跟帖按钮
-->
<RelativeLayout
android:id="@id/newsdetail_titlebar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/title_background"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
>
<TextView
android:id="@id/newsdetail_titlebar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="正纲教育软件"
android:textAppearance="?android:textAppearanceMedium"
android:layout_marginTop="10.0dip"
android:layout_marginLeft="20.0dip"
android:textColor="#ffffffff" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
>
<ImageButton
android:src="@drawable/toolbar_upload_photo_normal"
android:layout_gravity="right|center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_weight"
android:layout_marginTop="3.0dip"
android:layout_marginRight="10.0dip"
/>
</FrameLayout>
</RelativeLayout>
<!-- 用于翻页的的ViewFlipper -->
<ViewFlipper
android:id="@id/news_body_flipper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/newsdetail_titlebar_layout"
android:layout_marginBottom="40.0dip" >
</ViewFlipper>
<include
android:id="@id/comment_reply_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
layout="@layout/news_reply_frame_layout" />
</RelativeLayout>
RelativeLayout
用这种方式布局比较好控制
浙公网安备 33010602011771号