Android学习
1.设置gridview selector的时候有需要设置两个东西
在item中:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="100dip"
android:layout_height="100dip"
android:gravity="center_horizontal"
android:paddingTop="10dip"
android:paddingBottom="10dip"
android:background="@drawable/item_background_selector"
android:orientation="vertical" >然后在gridview中:
<GridView
android:listSelector="@drawable/item_background_selector"
android:id="@+id/gv_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dip"
android:numColumns="3">
</GridView>2.margin 是外部 padding是内部 做个按钮实验就看出来了
3.relative的一个bug 想让里面的图片居中不能在他里面设置grivity 没有效果 需要嵌套一个linnerlayout 原因是 button把居中消耗掉了
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_marginTop="5dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/setup1" />
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:id="@+id/bt_next"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:drawableRight="@drawable/next"
android:text="下一步" />
</RelativeLayout>

浙公网安备 33010602011771号