android 小技巧,不断更新中

1.weightSum属性和layout_weight 结合使用



实现上图的效果,不管横竖屏button 都占屏幕的50%的

 <LinearLayout  android:layout_width="match_parent" android:layout_height="match_parent" android:background="#cdcdcd" android:gravity="center" android:weightSum="1">        <Button  android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5" android:text="50%" />  <!--还可以试下80%,都有效果的-->    </LinearLayout>

这个功能在实际开发中还是蛮有用的,有很好的适配性。

更多相关文章

  1. android gridview 属性集合
  2. Android应用开发之(你必须知道的android selector下的属性值)
  3. Android(安卓)Studio 改变app启动页面
  4. android之点击回退键俩次退出程序
  5. 四则运算第一次冲刺
  6. Android的ViewFlipper与GestureDetector
  7. Android(安卓)生成和Pull解析xml
  8. 越过Android中布局文件中使用onClick属性的坑
  9. SetContentView 到底Set去哪里呢?

随机推荐

  1. Android系统添加全局快捷键的方法
  2. Android学习之 VideoView,SurfaceView 资
  3. Android开发案例,工具,教程合集
  4. React-Native Android 环境搭建
  5. 你应该知道的那些Android小经验
  6. Android跨进程通信IPC之4——关于"JNI"的
  7. 关于Android Service的一些补充
  8. Android事件分发,拦截,处理机制
  9. Android 7.1.1中SystemProperties 设置属
  10. Java反射学习