【发布时间】:2014-01-25 22:37:28
【问题描述】:
我希望我的GridLayout 具有像下图中的 3 Buttons 那样的圆角。这是否需要针对诸如Buttons、TextViews 等视图的圆角使用不同的代码?
gameplayGL.setBackgroundResource(R.drawable.roundedcorners);
gameplayGL.setBackgroundColor(Color.BLUE);
gameplayGL.getBackground().setAlpha(35);
圆角.xml
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:bottomLeftRadius="8dp"
android:bottomRightRadius="8dp"
android:topLeftRadius="8dp"
android:topRightRadius="8dp" />
</shape>
【问题讨论】:
-
我是否尝试过我发布的代码?是的,它给出了我发布的图像的输出。请注意,围绕 3 个按钮的布局没有圆角。
标签: java android layout rounded-corners grid-layout