Java Android网格布局边框
我正在做一个抽搐疗法 但是,我想在我的Java Android网格布局边框,java,android,Java,Android,我正在做一个抽搐疗法 但是,我想在我的GridLayout(Board) 以下是我的gridLayout的代码 <android.support.v7.widget.GridLayout android:id="@+id/boardGrid" app:columnCount="3" app:rowCount="3" app:alignmentMode="alignBounds"
GridLayout(Board)
以下是我的gridLayout的代码
<android.support.v7.widget.GridLayout
android:id="@+id/boardGrid"
app:columnCount="3"
app:rowCount="3"
app:alignmentMode="alignBounds"
app:layout_widthPercent="100%"
app:layout_aspectRatio="100%"
android:background="@drawable/burledwood"
android:layout_centerVertical="true">
非常感谢您的帮助。创建border.xml文件:-
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#00fb9a"/>
<stroke
android:color="#5d05ff"
android:width="3dp"/>
</shape>
</item>
</selector>
将该背景文件作为可在GridLayout中绘制的背景应用
<android.support.v7.widget.GridLayout
android:id="@+id/boardGrid"
app:columnCount="3"
app:rowCount="3"
app:alignmentMode="alignBounds"
app:layout_widthPercent="100%"
app:layout_aspectRatio="100%"
android:background="@drawable/border"
android:layout_centerVertical="true">
thanx感谢您的回复,但不幸的是,这是关于gridview的,而不是gridlayout,两个不同的东西,很大的不同:/让我试试。。。哦,不。。。我正在用我的脚本设置背景,因为有多个。。。。所以这是行不通的。。。我想将自定义边框放到GridLayout中创建一个自定义适配器,然后在自定义适配器xml的主视图中使用相同的border.xml听起来不错…您能提供一些基本代码来帮助我了解一下想法和概况吗,先生?:)您可以为此使用自定义gridview。