在我的 android 应用程序 Activity 中,我需要安排 6 个按钮,如下所示: 按钮从 1 到 6 命名。当我尝试将每个按钮作为背景添加到按钮时,出现按钮相互重叠的问题。按钮的背景 png 图像是三角形的。当我将这些背景 png 添加到按钮时,它的背景图像发生了变化,但按钮的边框仍然是矩形。所以我需要带有三角形边框的按钮,这样我就可以将它们放置在如下图所示的格式中。我也不知道哪种布局最适合这种类型模式。所以请也建议..
最佳答案
试试三角形:将其称为 TextView 或任何 TextView 的背景。
三角形.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="45"
android:toDegrees="45"
android:pivotX="-40%"
android:pivotY="100%"
>
<shape android:shape="rectangle">
<corners android:radius="15dip" />
<solid android:color="@color/blue" />
</shape>
</rotate>
</item>
</layer-list>
// TextView 调用
<TextView
android:layout_width="@dimen/triangle"
android:layout_height="@dimen/triangle"
android:rotation="90"
android:layout_centerVertical="true"
android:background="@drawable/triangle"/>
关于android - Android Activity 的三角形按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25398788/