- 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧
我正在尝试制作一个正方形的Grid-layout(嵌套在Constraint-layout中),所有边都等于父宽度,以便在任何设备上,用户都可以在屏幕上看到最大的正方形。然后,我想在第一个正方形中再有四个正方形,它们将是带有背景图像的线性布局,并将根据网格布局像元大小进行拉伸。理想情况下,我想使用XML进行此操作。我是android的初学者,在下面的代码中可……继续阅读 »
我正在尝试使用此代码创建StaggeredGrid。
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
View view=inflater.inflate(R.layout……继续阅读 »
我的Java代码如下所示:
Table_And_Login_Layout = new LinearLayout(context);
Table_And_Login_Layout.setId(View.generateViewId());
Table_And_Login_Layout.setBackgroundColor(Color.rgb(88, 188, ……继续阅读 »
我正在尝试使用2列3行的图片网格。但是我的屏幕上只显示一项。我不确定为什么。
这就是我得到的:
这就是我想要实现的目标:
到目前为止,这是我的代码。我正在关注YouTube上的教程,并且已经多次检查。我仍然不确定出什么问题:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xml……继续阅读 »
<GridLayout
android:id="@+id/gridLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+……继续阅读 »
<GridLayout
<ImageView
android:id="@+id/freeParking"
android:layout_width="52dp"
android:layout_height="58dp"
……继续阅读 »