如何强制Android GridView生成方格单元格(Cell的高度等于单元格的宽度)GridView有10*9个单元格,应用程序必须支持多个屏幕!
我使用了线性布局:
row_grid.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="0dp" >
<ImageView
android:id="@+id/item_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/ic_launcher" >
</ImageView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
和GridView: activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/katy" >
<GridView
android:id="@+id/gridView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:horizontalSpacing="0dp"
android:numColumns="4"
android:stretchMode="columnWidth"
android:verticalSpacing="0dp" >
</GridView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
GridView的每个单元格都包含具有相同宽度和高度的图像.图像比细胞大,必须伸展以适应细胞.

我找到了2种捕捉onMinimize事件的方法.
第一:关于FormResize事件:
if MyForm.WindowState = wsMinimized then ......
Run Code Online (Sandbox Code Playgroud)
第二:声明消息处理程序如下:
procedure WMSize(var Msg: TMessage); message WM_SIZE;
Run Code Online (Sandbox Code Playgroud)
然后:
procedure TForm57.WMSize(var Msg: TMessage);
begin
if Msg.WParam = SIZE_MINIMIZED then ....
end;
Run Code Online (Sandbox Code Playgroud)
哪种方式更好?!
Delphi应用程序中的表单数量是否有任何限制?我开发了一个包含40个或更多表单的应用程序(使用Delphi XE4),我很关心它的性能!
按需创建Forms而不是在应用程序启动时创建所有这些是一个好主意吗?