效果图如下:

代码如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/platformbg"
android:orientation="vertical" > <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical" > <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:orientation="horizontal" > <TextView
android:id="@+id/txtTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="刚刚"
android:textColor="#276095"
android:textSize="12dp" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="来自"
android:textColor="#276095"
android:textSize="12dp" /> <TextView
android:id="@+id/txtFromUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="管理员"
android:textColor="@color/white"
android:textSize="12dp" />
</LinearLayout> <RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:padding="8dp" > <LinearLayout
android:id="@+id/llLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" > <ImageView
android:id="@+id/imgMember"
android:layout_width="80dp"
android:layout_height="60dp"
android:background="@drawable/cy_face" />
</LinearLayout> <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toLeftOf="@id/llRight"
android:layout_toRightOf="@id/llLeft"
android:orientation="vertical" > <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="主题:"
android:textColor="@color/customGray"
android:textSize="12dp" /> <TextView
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="关于群管理解决办法"
android:textColor="@color/customGray"
android:textSize="12dp" />
</LinearLayout> <TextView
android:id="@+id/txtContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:singleLine="false"
android:text="懂得太多,看的太透,就会变成世界的孤儿。要知道,世界上有两样东西不忍直视..."
android:textColor="@color/customGray"
android:textSize="9dp" />
</LinearLayout> <LinearLayout
android:id="@+id/llRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_marginLeft="10dp" > <ImageView
android:id="@+id/imgRemove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/remove" />
</LinearLayout>
</RelativeLayout>
</LinearLayout> </LinearLayout>

Android RelativeLayout 实现左右中布局的更多相关文章

  1. android RelativeLayout属性和布局实例

    // 相对于给定ID控件 android:layout_above 将该控件的底部置于给定ID的控件之上; android:layout_below 将该控件的底部置于给定ID的控件之下; andro ...

  2. Android:控件布局(相对布局)RelativeLayout

    RelativeLayout是相对布局控件:以控件之间相对位置或相对父容器位置进行排列. 相对布局常用属性: 子类控件相对子类控件:值是另外一个控件的id android:layout_above-- ...

  3. android LinearLayout和RelativeLayout实现精确布局

    先明确几个概念的区别: padding margin:都是边距的含义,关键问题得明白是什么相对什么的边距padding:是控件的内容相对控件的边缘的边距. margin  :是控件边缘相对父空间的边距 ...

  4. Android精通:TableLayout布局,GridLayout网格布局,FrameLayout帧布局,AbsoluteLayout绝对布局,RelativeLayout相对布局

    在Android中提供了几个常用布局: LinearLayout线性布局 RelativeLayout相对布局 FrameLayout帧布局 AbsoluteLayout绝对布局 TableLayou ...

  5. Android RelativeLayout相对布局

    RelativeLayout是相对布局控件:以控件之间相对位置或相对父容器位置进行排列. 相对布局常用属性: 子类控件相对子类控件:值是另外一个控件的id android:layout_above-- ...

  6. Android五大布局详解——RelativeLayout(相对布局)

    RelativeLayout 接着上一篇,本篇我将介绍RelativeLayout(相对布局)的一些知识点. RelativeLayout 这是一个非常常用的布局,相比于上节所学到的LinearLay ...

  7. Android开发-之五大布局

    在html中大家都知道布局是什么意思了,简单来说就是将页面划分模块,比如html中的div.table等.那么Android中也是这样的.Android五大布局让界面更加美化,开发起来也更加方便.当然 ...

  8. Android中常用的布局

    一般分为5大类. Android中所有的空间第一字母都是大写 1.线性布局 LinearLayout 2.相对布局 RelativeLayout 3.帧布局--分层显示  FrameLayout 4. ...

  9. [Android] RelativeLayout, LinearLayout,FrameLayout

    Android RelativeLayout 属性 // 相对于给定ID控件 android:layout_above 将该控件的底部置于给定ID的控件之上; android:layout_below ...

随机推荐

  1. 21个常用的PHP代码汇总

    PHP 是目前使用最广泛的基于 Web 的编程语言,驱动着数以百万计的网站,其中也包括如 Facebook 等一些大型站点.这里收集了 21个日常开发中实用便捷的 PHP 代码,希望可以对一些 PHP ...

  2. JS获取汉字首字母

    //获取 汉字首字母 function makePy(str) { if (typeof (str) != "string") throw new Error(-1, " ...

  3. [Effective JavaScript 笔记]第62条:在异步序列中使用嵌套或命名的回调函数

    异步程序的操作顺序 61条讲述了异步API如何执行潜在的代价高昂的I/O操作,而不阻塞应用程序继续处理其他输入.理解异步程序的操作顺序刚开始有点混乱.例如,下面的代码会在打印"finishe ...

  4. Item 表单页面的 Select2 相关业务逻辑

    Select2 插件官网:https://select2.github.io/ Select2 初始化说明: 代码在 public/javascripts/subchannel_items.js 中的 ...

  5. [codeforces 528]B. Clique Problem

    [codeforces 528]B. Clique Problem 试题描述 The clique problem is one of the most well-known NP-complete ...

  6. setVolumeControlStream(int streamType)

    Android中有如下几种音频流: AudioManager.STREAM_MUSIC  /** The audio stream for music playback */ AudioManager ...

  7. linux tar文件解压

    把常用的tar解压命令总结下,当作备忘: tar -c: 建立压缩档案-x:解压-t:查看内容-r:向压缩归档文件末尾追加文件-u:更新原压缩包中的文件 这五个是独立的命令,压缩解压都要用到其中一个, ...

  8. apache virtualhost配置 apache配置多个网站

    第一步 apache下httpd.conf文件 启用模块LoadModule vhost_alias_module modules/mod_vhost_alias.so 第二步 apache下http ...

  9. BZOJ 3540 realtime-update 解题

    分析一下题意,大约是给定一串牛,然后找到一个跨越距离最长的牛子串使得在这个范围内白牛和花牛一样多. 白牛可以任意涂成花牛. 既然"白牛可以任意涂成花牛",那么我们需要找到一个最长的 ...

  10. Python: 什么是*args和**kwargs

    转自: http://blog.sina.com.cn/s/blog_65a8ab5d0101fglm.html http://blog.csdn.net/chenjinyu_tang/article ...