RelativeLayout中实现控件平分屏幕

<RelativeLayout
  android:layout_width="fill_parent"
  android:layout_height="wrap_content">
  <View
     android:id="@+id/placeholder"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_centerHorizontal="true"/>
  <Button
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_alignRight="@id/placeholder"
    android:layout_alignParentLeft="true"
    android:text="Left"/>
  <Button
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@id/placeholder"
    android:layout_alignParentRight="true"
    android:text="Right"/>
</RelativeLayout>

  

时间: 2024-07-31 16:14:30

RelativeLayout中实现控件平分屏幕的相关文章

Android RelativeLayout中实现控件平分屏幕

? 1 <!-- ? 1 RelativeLayout 达到平分效果 ? 1 --> ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 <br><RelativeLayout     android:layout_width="fill_parent"     android:layout_height="wrap_content">     <View<br&g

RelativeLayout中include 控件覆盖重叠的问题

RelativeLayout直接include另一个layout是会把include中的控件与当前layout中的控件覆盖重叠,经过查资料 其中的include标签一定要加上(因为include中不指定这二个属性其他所有属性都无效) android:layout_height="wrap_content" android:layout_width="match_parent" 二个属性并指定id属性android:id="@+id/head" 再

Android得到控件在屏幕中的坐标

getLocationOnScreen ,计算该视图在全局坐标系中的x,y值,(注意这个值是要从屏幕顶端算起,也就是索包括了通知栏的高度)//获取在当前屏幕内的绝对坐标 getLocationInWindow ,计算该视图在它所在的widnow的坐标x,y值,//获取在整个窗口内的绝对坐标 (不是很理解= =.) getLeft , getTop, getBottom, getRight, 这一组是获取相对在它父亲里的坐标 如果在Activity的OnCreate()事件输出那些参数,是全为0,

获取屏幕高宽,在代码中设置控件大小的方法

获取屏幕高宽的方法: 1 import android.view.Display; 2 import android.view.WindowManager; 3 WindowManager windowManager = getWindowManager(); 4 Display display = windowManager.getDefaultDisplay(); 5 if(display.getWidth()==480 && display.getHeight()== 272 ||

设定当前视图中所有控件字体的方法

     本范例实现的是对界面中所有的控件一次性的设置字体样式.思路是找到父控件,然后遍历子控件.如果子控件是可以修改文字的控件,那么就设置文字.这用到了控件的继承,很多控件都是继承与textview的,所以将控件均转为textview,最后设置字体即可. 布局文件 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.

android include中的控件调用

项目中经常会有一些布局是重用的,但是如何来更好的利用这些布局中的控件 转: http://zhidao.baidu.com/link?url=GU93U8Wu31dfp7mKEx52hMJkxjFLCq3WGkvZ8IMrahQT3wgAbC1Y93sKQ36_GQo3V4-Q9KWRHD6RIxMgBYj0zY7YsYNQuGFGjahZsFnz9wq <include android:id="@+id/view_counter_buttons_1" layout="

Android自定义控件系列 十:利用添加自定义布局来搞定触摸事件的分发,解决组合界面中特定控件响应特定方向的事件

这个例子是比较有用的,基本上可以说,写完这一次,以后很多情况下,直接拿过来addView一下,然后再addInterceptorView一下,就可以轻轻松松的达到组合界面中特定控件来响应特定方向的触摸事件了. 请尊重原创劳动成果,转载请注明出处:http://blog.csdn.net/cyp331203/article/details/45198549,非允许请勿用于商业或盈利用途,违者必究. 在写Android应用的过程之中,经常会遇到这样的情况:界面包含了多个控件,我们希望触摸在界面上的不

ArcGIS Engine开发之旅03--ArcGIS Engine中的控件

原文 ArcGIS Engine开发之旅03--ArcGIS Engine中的控件 制图控件,如MapControl.PageLayoutControl,其中MapControl控件主要用于地理数据的显示和分析,PageLayoutControl用于生成一幅成品地图.MapControl封装了Map对象,而PageLayoutControl则封装了PageLayout对象.这两个控件都实现了IMxContents接口,因此不仅可以读取ArcMap创建的地图文档,而且可以将自身的地图内容写到一个新

Android中常用控件及属性

在之前的博客为大家带来了很多关于Android和jsp的介绍,本篇将为大家带来,关于Andriod中常用控件及属性的使用方法,目的方便大家遗忘时,及时复习参考.好了废话不多讲,现在开始我们本篇内容的介绍. 1.控制应用显示的方向: setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//竖直显示效果. setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LA