Skip to content

Latest commit

 

History

History
112 lines (89 loc) · 3.27 KB

README.md

File metadata and controls

112 lines (89 loc) · 3.27 KB

ExcelLayout

说明

一个简单又好用的表格Layout

注:由于是模拟器在PC端的截图,所以图中表格框会展示出粗细不一的情况。真机无此现象。

如何使用

导入Layout源码,链接如下 https://github.com/LVinnie/ExcelLayout/blob/master/app/src/main/java/com/vinnie/weight/ExcelLayout.java

将下面代码加入attrs.xml文件

<declare-styleable name="ExcelLayout">
    <attr name="ELBorderColor" format="color" />  //边框颜色
    <attr name="ELStartX" format="integer" />     //开始的X坐标
    <attr name="ELStartY" format="integer" />     //开始的Y坐标
    <attr name="ELSpanX" format="integer" />      //View所占X轴的格数
    <attr name="ELSpanY" format="integer" />      //View所占Y轴的格数
</declare-styleable>

布局使用页面代码

<com.vinnie.weight.ExcelLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:ELBorderColor="@color/colorPrimary">

    <View
        android:layout_width="match_parent"
        android:layout_height="60dp"
        app:ELStartX="0"
        app:ELStartY="0"/>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="我是TextView"
        android:gravity="center"
        app:ELStartX="1"
        app:ELStartY="0"/>

    <ProgressBar
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:ELStartX="2"
        app:ELStartY="0"
        app:ELSpanX="2"
        app:ELSpanY="1"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:hint="我是EditText"
        app:ELStartX="0"
        app:ELStartY="1"
        app:ELSpanX="3"/>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@mipmap/ic_launcher"
        android:scaleType="fitXY"
        app:ELStartX="3"
        app:ELStartY="1"
        app:ELSpanX="1"
        app:ELSpanY="2"/>

    <SeekBar
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:ELStartX="0"
        app:ELStartY="2"
        app:ELSpanX="2"
        app:ELSpanY="1"/>

    <Button
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="我是Button"
        android:gravity="center"
        app:ELStartX="2"
        app:ELStartY="2"/>


</com.vinnie.weight.ExcelLayout>

License

Copyright 2018 LVinnie

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Android Arsenal