zoukankan      html  css  js  c++  java
  • 使用include布局进行布局优化

    <include
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    layout="@layout/include_title" />

    include子页面

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@color/white">
    <RelativeLayout
    android:id="@+id/top_bar"
    android:layout_width="fill_parent"
    android:layout_height="45dp"
    android:background="@color/theme_red"
    >
    <RelativeLayout
    android:id="@+id/title_left"
    android:layout_width="45dp"
    android:layout_height="fill_parent"
    android:background="@drawable/white_to_blackoverlay_btn"
    android:clickable="true"
    android:visibility="gone" >
    <TextView
    android:id="@+id/title_left_tv"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:text="返回"
    android:textColor="@color/white"
    android:textSize="15sp" />
    </RelativeLayout>
    <RelativeLayout
    android:id="@+id/title_left_btn"
    android:layout_width="45dp"
    android:layout_height="fill_parent"
    android:background="@drawable/white_to_blackoverlay_btn"
    android:clickable="true"
    android:visibility="gone" >

    <ImageView
    android:id="@+id/left_icon"
    android:layout_width="20dp"
    android:layout_height="20dp"
    android:layout_centerInParent="true" />
    </RelativeLayout>

    <RelativeLayout
    android:id="@+id/title_right"
    android:layout_width="45dp"
    android:layout_height="fill_parent"
    android:layout_alignParentRight="true"
    android:background="@drawable/white_to_blackoverlay_btn"
    android:clickable="true"
    android:visibility="gone" >
    <ImageView
    android:id="@+id/right_icon"
    android:layout_width="20dp"
    android:layout_height="20dp"
    android:layout_centerInParent="true" />
    </RelativeLayout>

    <RelativeLayout
    android:id="@+id/title_text_right"
    android:layout_width="50dp"
    android:layout_height="fill_parent"
    android:layout_alignParentRight="true"
    android:background="@drawable/white_to_blackoverlay_btn"
    android:clickable="true"
    android:visibility="gone" >
    <TextView
    android:id="@+id/title_right_tv"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:textColor="@color/white"
    android:textSize="15sp" />
    </RelativeLayout>
    <TextView
    android:id="@+id/title_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:text="@string/app_title"
    android:textColor="@color/white"
    android:textSize="18sp" />
    </RelativeLayout>

    </RelativeLayout>

  • 相关阅读:
    Text box to accept only number
    两个经典的Oracle触发器示例
    ELK部署
    Win10+CentOS7双系统引导修复
    自定义多选框(checkbox)和单选框(radio)css样式
    js事件
    js数组与字符串处理 slice、splice、substring、substr、push、pop、shift、reverse、sort、join、split
    css入门基础
    cocos2dx基础篇(7) 触碰事件
    cocos2dx基础篇(6) 定时器schedule/update
  • 原文地址:https://www.cnblogs.com/xiaoshumiao/p/6368206.html
Copyright © 2011-2022 走看看