效果图:

activity_main.xml:

<?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=".MainActivity">    <RelativeLayout        android:layout_marginTop="80sp"        android:layout_width="match_parent"        android:layout_height="wrap_content">        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_toLeftOf="@+id/center"            android:textSize="20dp"            android:text="左"/>        <View            android:id="@+id/center"            android:layout_width="3dp"            android:layout_height="40dp"            android:layout_centerInParent="true"            android:background="#ff0303"/>        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_toRightOf="@+id/center"            android:textSize="20dp"            android:text="右"/>    </RelativeLayout>    </LinearLayout>

android:layout_toRightOf 在该id控件的右方
android:layout_toLeftOf 在该id控件的左方

更多相关文章

  1. Android之相对布局
  2. Android(安卓)ListView控件基本用法
  3. [Android]【安卓】开发小结
  4. android 布局详解
  5. Android中UI设计的一些技巧!!!
  6. Android中的五大布局
  7. Android抽屉实现
  8. Android的文本系列的控件
  9. android的图片添加、滚动条、单选框、多选框、跳转界面

随机推荐

  1. Android Opencore PVPlayer
  2. Android 岗位 应聘所需 技能
  3. android Uri利用及解析(文件操作)以及与路
  4. Android 选项卡效果
  5. Android studio 混淆打包 proguard-rules
  6. Android selector选择器点击以后没反应
  7. Android Studio 打不开layout 文件夹下的
  8. Android的基站、WIFI、GPS定位集合【源码
  9. Android 高级开发进级必须要了解和进修的
  10. 安卓android readonly 无法增删文件