布局主要代码

Activity_main:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/bg2" >

<Button         android:id="@+id/button2"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_alignParentLeft="true"         android:layout_below="@+id/button1"         android:text="错题巩固" />

<Button         android:id="@+id/button3"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_alignParentLeft="true"         android:layout_below="@+id/button2"         android:text="退出" />

<Button         android:id="@+id/button1"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_alignParentLeft="true"         android:layout_alignParentTop="true"         android:layout_marginTop="148dp"         android:text="开始" />

</RelativeLayout>

CAL_MAIN:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg2"
    android:orientation="vertical" >

<Button
        android:id="@+id/button4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/textView2"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="18dp"
        android:text="确定" />

<TextView

android:id="@+id/textView1"

android:layout_width="fill_parent"

android:layout_height="50dp

"         android:layout_above="@+id/EditText1"

android:layout_centerHorizontal="true"

android:layout_marginBottom="30dp"

android:gravity="center"

android:textSize="20px"

android:editable="true" />

<EditText

android:id="@+id/EditText1"

android:layout_width="wrap_content"

android:layout_height="50dp"

android:layout_above="@+id/button4"

android:layout_centerHorizontal="true"

android:digits="1234567890.-"

android:ems="10"

android:numeric="decimal" >

<TextView

android:id="@+id/textView2"

android:layout_width="230dp"

android:layout_height="70dp"

android:layout_alignParentBottom="true"

android:layout_alignParentRight="true"

android:layout_marginBottom="135dp"

android:editable="true"

android:textSize="20px" />

<ImageView

android:id="@+id/imageView1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignBottom="@+id/textView2"

android:layout_alignTop="@+id/textView2"

android:layout_alignParentLeft="true"

android:layout_toLeftOf="@+id/textView2"/>

</RelativeLayout>

<requestFocus />

</EditText>

SHOW_MAIN:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/bg2">

<LinearLayout
       android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_gravity="center">

<LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center" >

<TextView
                android:id="@+id/textView1"
                android:layout_width="93dp"
                android:layout_height="wrap_content"
                android:editable="true"
                android:text="" />

<EditText
                android:id="@+id/EditText1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:digits="1234567890.-"
                android:ems="10"
                android:numeric="decimal"
                android:text="" >

<requestFocus />
            </EditText>
        </LinearLayout>

<Button
        android:id="@+id/button6"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="确定" />
        <Button
        android:id="@+id/button7"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="下一题" />
        <Button

android:id="@+id/button8"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="从错题库删除" />
        <Button
        android:id="@+id/button9"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="返回" />
  <LinearLayout
       android:layout_width="fill_parent"
      android:layout_height="match_parent"
      android:orientation="horizontal">
            <ImageView

android:id="@+id/imageView2"

android:layout_width="fill_parent"

android:layout_height="70dp"

android:layout_weight="5"/>

<TextView

android:id="@+id/textView2"

android:layout_width="fill_parent"

android:layout_height="70dp"

android:layout_weight="3"

android:editable="true"

android:text="" />

</LinearLayout>

</LinearLayout>

</LinearLayout>

时间: 2024-08-04 22:21:48

布局主要代码的相关文章

eclipse 设置代码大小和布局里面代码大小

Eclipse字体大小调整: Window /  Preferences / General / Appearance / ColorsAnd Fonts ,在右边的对话框里选择Java – Java Editor Text Font,点击出现的编辑(Edit)按钮,可以设置显示在在主窗体中程序的字体大小,设置完之后点击右下角的应用(Apply),最后点击确定(OK)即可. Xml文件字体大小的调整:  window / preferences / General / appearance /

IOS开发UI篇--UITableView的自定义布局==纯代码布局

UITableView中除了利用系统的UItableViewCell不能完成需求进行布局时,还可以进行自定义布局: 自定义布局分为两类:(1)利用代码进行创建 (2)利用xib进行实现: 下面对利用代码进行创建分析: 应用场景:像微博,等列表数据展示(由于微博的每个单元格的数据大小不一致,所以得计算每个单元格的大小) 分析:前提是获取列表数据,然后建立每个单元格的模型(建立单元格模型应继承UITableViewCell)复写 - (id)initWithStyle:(UITableViewCel

021_03布局之代码实现

一般情况下对于Android程序布局我们往往使用XML文件来编写,这样可以提高开发效率.但是考虑到代码的安全性以及执行效率,可以通过Java代码执行创建.当然Java处理效率比XML快得多,但是对于一个复杂界面的编写,可能需要一些套嵌考虑,如果你思维灵活的话,使用Java代码来布局你的Android应用程序是一个更好的方法. 1 package com.example.day21_03ProgrammingUI; 2 3 import android.app.Activity; 4 import

ios xib和代码的frame布局 iOSXib布局后代码修改约束的值

如何修改autolayout 约束的值? 1 2 3 4 5 6 目前我已知的方法有5种 1.修改frame(有时候可能会不起作用,但可以做动画) 2.修改约束的float值 3.使用VisualFormat 语言 4.使用 constraintWithItem,按倍率改变   如  2x+1=Y  5.移除约束(remove at runtime),添加新的约束 前面的文章已经讲到如何使用storyboard 创建约束了,但是在实际的开发中我们经常需要适配不同的屏幕尺寸和系统版本,这时我们就

Object-C iOS纯代码布局 一堆代码可以放这里!

前言: 最近写的文章都是创业类,好吧,今天好好写写技术类的文章! 不过分享的不是IOS相关的文章,毕竟这几天在速成IOS,看的是objective-c,由于速成的很快,好累! 好在现在基本已经入了点门道了,这才看的懂新人的代码,才能提前感受代码危机. 对于IOS的速成口诀,回头再分享,今天先分享一个简单的抽象封装! 1:先看看问题 说明:通常对于界面布局,有编写代码.Xib.Storyboard三种方式,而我看到新人写的,是通过代码布局的. 看到的代码是这样的: A:编写UI的代码已分离到新的类

web app iphone4 iphone5 iphone6 响应式布局 适配代码

from:http://www.phptext.net/article_view.php?id=387 在满大街的APP,除了游戏,软件图形类的需要用原生开发好点.现在大多还是基于WEBAPP或者混合的hybrid app,大家都知道资讯类的小应用其实网页就可以胜任,当然如果你要调用一些应设备,原生的APP外hybrid app也是一个不错的选择.不过我们今天的主角是WEB APP,WEB APP好处就是,随时随地有网就能看,简单实用.对于开发来说,更是低成本高效率,当然对于追求细致的来说...

移动端,手机端 响应式布局头部代码

<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="a

div+css页面布局-html代码

<html> <head> <title>div+css页面布局</title> <meta http-equiv="content-type" content="text/html" > <link rel="stylesheet" type="text/css" href="css/layout.css" /> </head&

web app iphone4 iphone5 iphone6 iphone6 Plus响应式布局 适配代码

来源:http://www.phptext.net/article_view.php?id=387 ------------------------------------------------------------------------------------------------ 文章摘要:最近接触到一个项目由于客户要求的比较~~所以也参与了下,结果晋级了一下~~来和大家分享~~ 现在满大街的APP,除了游戏,软件图形类的需要用原生开发好点.现在大多还是基于WEBAPP或者混合的hy

jq超简单的流式布局,代码简单,容易修改

1.看看效果吧! 2.html代码index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> ul{position: relative;padding: 0 -3px;list-style: none;width: 600px;margi