安卓开发时的坑总结
有一个布局件是这样的。
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="68dp" android:minHeight="68dp" android:background="@drawable/common_item_bg"> <TextView android:id="@+id/tv_left_top" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_margin="8dp" android:text="左上" /> <TextView android:id="@+id/tv_right_top" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_margin="8dp" android:text="右上" /> <TextView android:id="@+id/tv_left_bottom" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_margin="8dp" android:text="左下" /> <TextView android:id="@+id/tv_right_bottom" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_margin="8dp" android:text="右下" /> </RelativeLayout>
设置有android:layout_alignParentBottom="true"
的TextView 的android:layout_margin="8dp"
里的magrin_bottom不起作用,再套一层RelativeLayout就好了
坑二:其实这个也不算坑,只是自己没看api
new Handler() 和new Handler(Looper.getMainLooper())
浙公网安备 33010602011771号