gridlayout

GUI编程-图形用户界面编程

流过昼夜 提交于 2020-02-27 10:42:43
1、GUI简介 GUI的核心技术:Swing、AWT。 现在基本没人使用。 为什么学习GUI: 1、可以写一些小工具 2、工作时候,有可能需要维护到Swing界面 3、了解MVC架构,了解监听。 2、AWT(抽象的窗口工具) 包含了很多的类和接口。存在于java.awt包下。 元素:窗口、按钮、文本框…… 2.1、组件和容器 Frame(窗口) //gui的第一个界面 public class FrameTest { public static void main ( String [ ] args ) { Frame frame = new Frame ( "我的第一个gui窗口" ) ; //设置可见性 frame . setVisible ( true ) ; //设置窗口大小 frame . setSize ( 300 , 300 ) ; //设置背景颜色 frame . setBackground ( new Color ( 9 , 9 , 255 ) ) ; //设置弹出的初始位置 frame . setLocation ( 200 , 200 ) ; //设置窗口大小固定 frame . setResizable ( false ) ; //默认是true,不固定 false固定 } } 停止java程序,才可以关掉窗口。 public class

PYTHON之PYQT编程

十年热恋 提交于 2019-12-28 17:14:49
1、windows窗口的建立 1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 # @Time : 2019/8/19 10:09 4 # @Site : 5 # @File : advertisingRunner.py 6 # @Software: PyCharm 7 8 import sys 9 10 from ui_class.ui_Elements import * 11 from public_class.common_method import * 12 13 14 class MainWindow(QMainWindow): 15 16 def __init__(self): 17 18 super(MainWindow,self).__init__() 19 self.initUI() 20 21 def initUI(self): 22 23 self.setGeometry(300, 300, 1200, 800) 24 self.setWindowTitle('标题') 25 self.setWindowIcon(QIcon('标题icon.png'))#icon图片需与当前文件在同级目录下,否则需带入路径 26 self.statusBar() 27 self.menus() 28 self.show()

在SOUI中使用网格布局

拈花ヽ惹草 提交于 2019-12-24 18:08:20
在实现网格布局前,SOUI支持两种布局形式:相对布局,和线性布局,其中线性布局是2017年2月份才支持的布局。 这两年工作都在Android这里,Android里有号称5大布局(RelativeLayout, LinearLayout, FrameLayout, GridLayout,TableLayout)。 FrameLayout很简单,在SOUI里一般用TabCtrl就实现了。RelativeLayout和SOUI自己的相对布局功能类似,线性布局也有了,但是一直没有实现GridLayout(TableLayout和GridLayout类似)。 之所以没有做GridLayout,主要是觉得组合SOUI现有的布局功能可以模拟出GridLayout的效果,哲学说:如无必要,勿增实体。 前几天群里有人问做一个行列对齐的布局在SOUI里要怎么实现。我回答说用线性布局去组合。 后来认真想了想,虽然线性布局组合可以勉强达到效果,但是布局写起来还是会很难看,这时候我才感觉到了实现一个GridLayout的必要性。 好在SOUI的布局系统经过前一段时间的重构已经能够很容易的扩展,要实现一个GridLayout也不是什么困难的事。 经过近一周的打磨,SOUI版的GridLayout已经通过了主要的测试,至少能够满足我的布局要求了。 下面我们先看看效果,再看在SOUI里要如何使用。

android GridLayout

落花浮王杯 提交于 2019-12-05 06:54:35
结构 继承关系 public class GridLayout extends ViewGroup java.lang.Object android.view.View android.view.ViewGroup android.widget. GridLayout 该布局把子视图存放在一个矩形网格中。 网格是由被无数虚细线分割成多个单元格的可视区域组成。贯穿整个 API 的网格线通过网格索引数来指定。一个 N 列的网格在运行中包含 0 到 N 的 N+1 个索引,不管怎么配置 GridLayout 网格索引 0 是固定网格容器的前边距,索引 N 是固定容器的后边距(考虑后填充)。 行和列的规格 在 rowSpec 和 columnSpec 布局参数的定义后, 子视图占用一个或者多个连续单元格,每个规范是定义被占用的行或列的设置和子视图在单元格是如何对齐。尽管各个单元格在一个 GridLayout 中不重叠, GridLayout 并 没有阻止子视图被定义为占据相同的单元格或者单元格组。 然而在这种情况下,也不能保证子视图在布局操作完成后自己不会重叠。 默认单元格分配 如果一个子视图没有指定占据的行和列索引, GridLayout 会自动指定单元格位置,包括:方向,行数和列数的属性。 空间 (Place) 子视图之间的空间可能会通过使用专用的空间视图的实例,或通过设置

浅谈android4.0开发之GridLayout布局

…衆ロ難τιáo~ 提交于 2019-12-04 06:49:30
本文重点讲述了自android4.0版本后新增的GridLayout网格布局的一些基本内容,并在此基础上实现了一个简单的计算器布局框架。通过本文,您可以了解到一些android UI开发的新特性,并能够实现相关应用。 在android4.0版本之前,如果想要达到网格布局的效果,首先可以考虑使用最常见的LinearLayout布局,但是这样的排布会产生如下几点问题: 1、不能同时在X,Y轴方向上进行控件的对齐。 2、当多层布局嵌套时会有性能问题。 3、不能稳定地支持一些支持自由编辑布局的工具。 其次考虑使用表格布局TabelLayout,这种方式会把包含的元素以行和列的形式进行排列,每行为一个TableRow对象,也可以是一个View对象,而在TableRow中还可以继续添加其他的控件,每添加一个子控件就成为一列。但是使用这种布局可能会出现不能将控件占据多个行或列的问题,而且渲染速度也不能得到很好的保证。 android4.0以上版本出现的GridLayout布局解决了以上问题。GridLayout布局使用虚细线将布局划分为行、列和单元格,也支持一个控件在行、列上都有交错排列。而GridLayout使用的其实是跟LinearLayout类似的API,只不过是修改了一下相关的标签而已,所以对于开发者来说,掌握GridLayout还是很容易的事情

QGridLayout, 3 panes, not expanding properly

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to layout a window (all in code) with a QGridLayout . I can add widgets to the layout and they display in my window, but I can't figure out how to resize them properly. Here's what I'd like [Leftmost][--------Center---------][Rightmost] Those are the 3 "panes" of my window (all three of them lists). The left and right ones should be of a static width and hug their respective sides, and the center should expand to fill the width as the window grows (or shrinks). Some code: // Create the subviews, add them to a grid layout, and set

GridLayout - Vertical/Horizontal constraints are inconsistent

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm posting this because I couldn't find exactly what I was looking for on SO and the rest of the web. I had a look at this , but I wasn't exactly sure how to solve the problem. The issue surfaced while I was using GridLayout in my app and whenever I rotated my screen, I would see an output something like this: In landscape mode: 06-23 21:41:25.627 10222-10222/in.cryf.yaca D/android.widget.GridLayout: vertical constraints: y1-y0>=112, y2-y1>=112, y3-y2>=112, y4-y3>=112, y4-y0<=311 are inconsistent; permanently removing: y4-y0<=311. In

网格布局 GridLayout

匿名 (未验证) 提交于 2019-12-02 23:55:01
网格布局,按照行、列组成一个个网格 界面代码: <? xml version = "1.0" encoding = "utf-8" ?> <GridLayout xmlns:android = "http://schemas.android.com/apk/res/android" xmlns:tools = "http://schemas.android.com/tools" xmlns:app = "http://schemas.android.com/apk/res-auto" android:layout_width = "match_parent" android:layout_height = "match_parent" android:rowCount = "6" android:columnCount = "4" android:id = "@+id/root" tools:context = ".MainActivity" > <TextView android:layout_width = "match_parent" android:layout_height = "wrap_content" android:layout_columnSpan = "4" android:textSize = "50sp" android:layout_marginLeft

Qt之QGridLayout布局简单应用

匿名 (未验证) 提交于 2019-12-02 23:40:02
实现A、B、C布局; 结构如图: 关键代码如下: MainWindow::MainWindow(QWidget *parent) : QWidget(parent) { this->setGeometry(QRect(0,0,1000,800)); QGridLayout *gridLayout = new QGridLayout; QWidget *widget1 = new QWidget(); QPushButton *A = new QPushButton("A",widget1); A->setGeometry(QRect(100,100,100,60)); QWidget *widget2 = new QWidget(); QPushButton *B = new QPushButton("B",widget2); B->setGeometry(QRect(100,100,100,60)); QWidget *widget3 = new QWidget(); QPushButton *C = new QPushButton("C",widget3); C->setGeometry(QRect(0,10,100,30)); widget1->setMaximumWidth(300); widget1->setMinimumWidth(300); widget3-

GridLayout

半腔热情 提交于 2019-12-01 17:53:47
GridLayout 使用 layout_columnWeight 属性的话, 在 api 21 及以上可以使用sdk 的 GridLayout 21以下的版本使用 gridlayout-v7 中的android.support.v7.widget.GridLayout 来源: oschina 链接: https://my.oschina.net/u/255456/blog/733341