当前位置: 首页 > news >正文

网站建设免费加盟代理财经新闻每日财经报道

网站建设免费加盟代理,财经新闻每日财经报道,php网站开发设计论文,ps怎么做网页设计1.LinearLayout 属性 orientation:内部组件排列方式,可选vertical、horizontal,默认horizontal layout_weight: 与平级组件长宽比例,需要将layout_width、layout_height其中一个设置为0dp,表明长或宽与平级组件的长…

1.LinearLayout

属性

orientation:内部组件排列方式,可选vertical、horizontal,默认horizontal

layout_weight: 与平级组件长宽比例,需要将layout_width、layout_height其中一个设置为0dp,表明长或宽与平级组件的长或宽成比例

示例代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".MainActivity4"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:text="horizontal 1 "android:textSize="30dp"></TextView><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:text="horizontal 2 "android:textSize="30dp"></TextView></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><TextViewandroid:layout_width="match_parent"android:layout_height="0dp"android:layout_weight="1"android:text="vertical 1 "android:textSize="30dp"></TextView><TextViewandroid:layout_width="match_parent"android:layout_height="0dp"android:layout_weight="1"android:text="vertical 2 "android:textSize="30dp"></TextView></LinearLayout></LinearLayout>

效果图:

2. RelativeLayout

可以指定内部View的相对位置:

相对于上级View的位置:例如 layout_centerInParent = "true"

相对于同级View的位置(包括相对位置和对齐方式): 例如 layout_toLeftOf = "@id/center"

若不指定,默认位于上级View的左上角

代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".MainActivity5"><TextViewandroid:id="@+id/center"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="center"android:layout_centerInParent="true"android:textSize="30dp"></TextView><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="centerHorizontal"android:layout_centerHorizontal="true"android:textSize="15dp"></TextView><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="alignParentRight"android:layout_alignParentRight="true"android:textSize="15dp"></TextView><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="alignParentBottom"android:layout_alignParentBottom="true"android:textSize="15dp"></TextView><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="at center left"android:layout_toLeftOf="@id/center"android:layout_alignTop="@id/center"android:textSize="15dp"></TextView><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="at center right"android:layout_toRightOf="@id/center"android:layout_alignBottom="@id/center"android:textSize="15dp"></TextView></RelativeLayout>

效果图:

 

3.GridLayout

表格布局,默认内部View从左往右,从上往下排列

columnCount, rowCount 分别表明列数和行数

代码;

<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:columnCount="2"android:rowCount="3" ><TextView android:layout_width="0dp"android:layout_columnWeight="1"android:layout_height="100dp"android:background="#ffaa00"android:text="1"android:textColor="#000000"android:textSize="30dp"android:gravity="center"></TextView><TextView android:layout_width="0dp"android:layout_columnWeight="1"android:layout_height="100dp"android:background="#ff00aa"android:text="2"android:textColor="#000000"android:textSize="30dp"android:gravity="center"></TextView><TextView android:layout_width="0dp"android:layout_columnWeight="1"android:layout_height="100dp"android:background="#11aa00"android:text="3"android:textColor="#000000"android:textSize="30dp"android:gravity="center"></TextView><TextView android:layout_width="0dp"android:layout_columnWeight="1"android:layout_height="100dp"android:background="#2200bb"android:text="4"android:textColor="#000000"android:textSize="30dp"android:gravity="center"></TextView><TextView android:layout_width="0dp"android:layout_columnWeight="1"android:layout_height="100dp"android:background="#0033ff"android:text="5"android:textColor="#000000"android:textSize="30dp"android:gravity="center"></TextView><TextView android:layout_width="0dp"android:layout_columnWeight="1"android:layout_height="100dp"android:background="#225511"android:text="6"android:textColor="#000000"android:textSize="30dp"android:gravity="center"></TextView></GridLayout>

效果图:

 4. ScrollView

ScrollView:垂直方向上滚动,layout_height设置为wrap_content
HorizontalScrollView:水平方向上滚动,layout_width设置为wrap_content

代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".MainActivity6"><HorizontalScrollViewandroid:layout_width="wrap_content"android:layout_height="300dp"><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="match_parent"android:orientation="horizontal"><Viewandroid:layout_width="300dp"android:layout_height="match_parent"android:background="@color/teal_200"></View><Viewandroid:layout_width="300dp"android:layout_height="match_parent"android:background="@color/purple_200"></View></LinearLayout></HorizontalScrollView><ScrollViewandroid:layout_width="match_parent"android:layout_height="wrap_content"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><Viewandroid:layout_width="match_parent"android:layout_height="500dp"android:background="@color/purple_700"></View><View android:layout_width="match_parent"android:layout_height="500dp"android:background="@color/red_66"></View></LinearLayout></ScrollView></LinearLayout>

效果图:

 

http://www.khdw.cn/news/61855.html

相关文章:

  • 手机银行网站建设seo的搜索排名影响因素有
  • 做公司网站的时间百度网盘客服电话24小时
  • html做的网站排版错误百度教育app
  • 无锡网站制作哪家不错广东百度推广的代理商
  • 洛阳高端网站建设制作网站平台
  • 课程网站怎么做可以投放广告的网站
  • 微网站手机制作营销传播
  • 长沙网站建站拍照搜索百度识图
  • 建成网站的关键是地方网站建设
  • 汕头建设局网站seo自动推广工具
  • 网站建设的程序郑州网站排名优化公司
  • 高大上的平面设计网站百度快速排名化
  • 如何建设自己的网站国外seo工具
  • 网站设计策划书怎么写推广之家
  • 怎么做cpa网站设计公司
  • 重庆水舟科技做网站seo如何进行优化
  • 如何做大型网站苏州seo排名优化课程
  • 小程序网站竞价服务托管公司
  • 微网站 下载自动推广引流app
  • 长沙百度网站建设培训心得体会2000字
  • dz论坛识别手机网站自动跳转百度推广账户登录
  • 个人网站做影视山东服务好的seo公司
  • 第一次做网站选多大空间微信crm系统
  • 潍坊网站建设公司哪家好找客户资源的网站
  • 宁波网站推广运营公司seo短视频入口
  • 蛋糕行业网站建设方案快速收录工具
  • 兽装定制网站安徽seo网络优化师
  • 网站建设优化重庆今日国际新闻摘抄
  • 有做任务赚钱的网站如何进行网站推广
  • 做网站 阿里云和百度云哪个好网络优化工资一般多少