Android开发中遇到的小问题 一
16lz
2022-03-04
1)想要ListView活着Girdview左右留些空隙,但Scrollbar要在屏幕最右边
在xml中加入
android:paddingLeft="8dp"android:paddingRight="8dp"android:scrollbarStyle="outsideOverlay"
2)用XML实现一个圆角矩形的drawable
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <corners android:radius="8dp" /> <solid android:color="#ffffffff" /></shape>
如果想要动态的改变圆角矩形的背景色
GradientDrawable gd = new GradientDrawable();// 设置圆角gd.setCornerRadius(8f);// 设置颜色gd.setColor(0xffffffff);
3) 在layout的xml中加入
android:animateLayoutChanges="true"
api level 大于等于11,在当布局改变的时候,会有动画效果
4) 如果使用了FrameLayout,并且用到了Margin,记得给FrameLayout设置一个android:layout_gravity,在2.2/2.3系统上,如果没有设置gravity,
Margin是无效的,算是一个系统的bug吧。
更多相关文章
- android的网络编程
- Android基础入门教程——2.2.1 LinearLayout(线性布局)
- activity属性设置大全
- 预显示TextView
- android 4中新增的日历处理相关API
- android模仿铃声选择功能
- Android(安卓)build system 分析之 envsetup.sh
- Android访问权限大全
- android键盘挡住界面