示例代码如下:

<LinearLayout

android:orientation="horizontal"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true">

<Button

android:id="@+id/btn_login"

android:layout_width="0.0px"

android:layout_height="wrap_content"

android:text="@string/login"

android:layout_weight="1.0"/>

<Button android:id="@+id/btn_logoff"

android:layout_width="0.0px"

android:layout_height="wrap_content"

android:text="@string/logoff"

android:layout_weight="1.0"

android:enabled="false"/>

</LinearLayout>

粗体即为指定各个控件的比重,这样指定以后,两个控件的比重一样,那么就会平分宽度了!

更多相关文章

  1. android自定义控件
  2. 常见UI控件的使用-富文本、textview
  3. WebView控件中的javascript与Android本地功能交互
  4. Android(安卓)面试题之基础(不断更新)
  5. 关于LinearLayout布局中,子控件平分宽度
  6. android 动态布局
  7. android如何获取url指定的图片资源
  8. EditText设置不自动获取焦点,点击后才获取,并弹出软键盘
  9. android intent——小白入口

随机推荐

  1. Java基础编程练习2,求一元二次方程aX^2+b
  2. 2021-04-12:判断二叉树是否是搜索二叉树?
  3. 4.2 vSphere软件组件详解
  4. 【DG】利用闪回数据库(flashback)修复Failo
  5. Kubernetes踩坑记---单点集群安装
  6. centos6下redis cluster集群部署过程
  7. 如何安装DBMS_NETWORK_ACL_ADMIN包?
  8. centos6下ActiveMQ+Zookeeper消息中间件
  9. shell脚本监控CPU脚本
  10. ipcs、ipcrm、sysresv、kernel.shmmax