android在RelativeLayout里的TextView或者EditView里放置ImageView使其居中;靠右显示设置
16lz
2021-01-23
代码这样就可以的:
<RelativeLayout android:layout_width="100dp" android:layout_height="30dp" > <TextView android:id="@+id/tv_birthday" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/d1" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_alignParentRight="true" android:src="@mipmap/ic_calendar" /> </RelativeLayout>
在RelativeLayout的包裹下:
ImageView里设置
android:layout_centerVertical=“true”(使其图片垂直居中)
android:layout_alignParentRight=“true” (使图片居右)
更多相关文章
- Android下图片或按钮等可拖动到任意位置的效果实现源码
- android 处理图片工具
- android ImageView 显示本地图片
- Android 圆角图片
- android 自定义checkbox大小和图片[已验证]
- android 图片设置圆角
- Android ------ 拍照相册选择图片 剪裁图片
- 改变ToggleButton的图片
- 设置Android app背景图片(Android studio)