Skip to content

Commit 1f4bf8b

Browse files
author
vendor
committed
初始化版本
1 parent aa83790 commit 1f4bf8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1377
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.DS_Store

README.md

+101
Original file line numberDiff line numberDiff line change
@@ -1 +1,102 @@
11
# HeaderLayout
2+
欢迎大家使用。<br>
3+
此自定义控件为头部标题栏控件<br><br>
4+
<B>主要提供内容:</B>
5+
6+
左边按钮:
7+
默认支持icon和文字两种方式(只能选一个,左边按钮默认只有一个)
8+
9+
标题文字:
10+
支持居左和居中显示
11+
12+
右边按钮:
13+
最多支持四个显示(2个文字、2个按钮 )
14+
15+
自定义效果:
16+
控件基于RelativeLayout,所以可以自由添加需要的内容
17+
![截了个图](./img.png)
18+
19+
<B>调用步骤:</B><br><br>
20+
**1、可配置的所有内容**
21+
22+
<?xml version="1.0" encoding="utf-8"?>
23+
<resources>
24+
<item name="hl_status_padding_iv" type="id"/>
25+
<item name="hl_navigation_view" type="id"/>
26+
27+
<color name="default_header_layout_title_textColor">#fff</color>
28+
<dimen name="default_header_layout_title_textSize">20sp</dimen>
29+
<dimen name="default_header_layout_menu_textSize">15sp</dimen>
30+
31+
<declare-styleable name="HeaderLayout">
32+
<attr name="hlSupportTranslucentStatus" format="boolean"/>
33+
<attr name="hlTitleText" format="string"/>
34+
<attr name="hlTitleTextColor" format="color"/>
35+
<attr name="hlTitleTextSize" format="dimension"/>
36+
<attr name="hlItemTextColor" format="color"/> <!-- 所有按钮文字按钮颜色 -->
37+
<attr name="hlItemTextSize" format="dimension"/> <!-- 所有按钮文字按钮大小-->
38+
<attr name="hlItemTextPaddingLeftAndRight" format="dimension"/> <!-- 所有文字按钮左右间距 -->
39+
<attr name="hlNavigationIcon" format="reference"/> <!-- 返回按钮 or 左边按钮 图片 二选一 -->
40+
<attr name="hlNavigationText" format="reference"/> <!-- 返回按钮 or 左边按钮 文字 二选一 -->
41+
<attr name="hlNavigationWidth" format="dimension" />
42+
<attr name="hlNavigationMinWidth" format="dimension" />
43+
<attr name="hlNavigationMaxWidth" format="dimension" />
44+
<attr name="hlNavigationHeight" format="dimension" />
45+
<attr name="hlNavigationMinHeight" format="dimension" />
46+
<attr name="hlNavigationMaxHeight" format="dimension" />
47+
<attr name="hlNavigationScaleType" format="enum">
48+
<enum name="matriX" value="0"/>
49+
<enum name="fitXY" value="1"/>
50+
<enum name="fitStart" value="2"/>
51+
<enum name="fitCenter" value="3"/>
52+
<enum name="fitEnd" value="4"/>
53+
<enum name="center" value="5"/>
54+
<enum name="centerCrop" value="6"/>
55+
<enum name="centerInside" value="7"/>
56+
</attr>
57+
<attr name="hlMenuIcon" format="reference"/> <!-- 右边按钮 -->
58+
<attr name="hlMenuIconId" format="reference"/> <!-- 右边按钮id -->
59+
<attr name="hlMenu2Icon" format="reference"/> <!-- 右边按钮 -->
60+
<attr name="hlMenu2IconId" format="reference"/> <!-- 右边按钮id -->
61+
<attr name="hlMenuText" format="string"/> <!-- 右边文字按钮 -->
62+
<attr name="hlMenuTextId" format="string"/> <!-- 右边文字按钮id -->
63+
<attr name="hlMenu2Text" format="string"/> <!-- 右边文字按钮 -->
64+
<attr name="hlMenu2TextId" format="string"/> <!-- 右边文字按钮id -->
65+
<attr name="hlMenuAlign" format="enum"> <!-- 右边按钮排序 -->
66+
<enum name="alignText" value="0"/> <!-- 文字在最右边 -->
67+
<enum name="alignIcon" value="1"/> <!-- 图标在最右边 -->
68+
<enum name="alternate" value="2"/> <!-- 图标 文字 图标 文字 -->
69+
<enum name="alternate2" value="3"/> <!-- 文字 图标 文字 图标 -->
70+
</attr>
71+
<attr name="hlSpitLineColor" format="reference"/> <!-- 底部分割线 -->
72+
<attr name="hlSpitLineHeight" format="dimension"/> <!-- 底部分割线 -->
73+
<attr name="hlTitleAlignLeft" format="boolean"/> <!-- 居左显示 -->
74+
</declare-styleable>
75+
</resources>
76+
77+
**2、布局引用**
78+
79+
<com.vendor.lib.widget.HeaderLayout
80+
android:layout_width="match_parent"
81+
android:layout_height="45dp"
82+
android:background="@drawable/title_bg"
83+
app:hlItemTextColor="@color/green"
84+
app:hlItemTextSize="13sp"
85+
app:hlNavigationMinWidth="45dp"
86+
app:hlTitleAlignLeft="true"
87+
app:hlNavigationScaleType="centerInside"
88+
app:hlNavigationIcon="@mipmap/back_btn"
89+
app:hlSupportTranslucentStatus="false"
90+
app:hlTitleText="@string/app_name"
91+
app:hlTitleTextColor="@color/black"
92+
app:hlTitleTextSize="18sp"
93+
app:hlMenuIcon="@mipmap/edit_ic"
94+
app:hlMenuIconId="@+id/edit_btn"
95+
app:hlMenuText="@string/edit"
96+
app:hlMenuTextId="@+id/edit_btn"
97+
app:hlMenu2Icon="@mipmap/add_ic"
98+
app:hlMenu2IconId="@+id/add_btn"
99+
app:hlMenu2Text="@string/add"
100+
app:hlMenu2TextId="@+id/add_btn" >
101+
102+
有问题联系:QQ群 254202293

app/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
*.DS_Store

app/build.gradle

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 26
5+
buildToolsVersion "26.0.0"
6+
defaultConfig {
7+
applicationId "com.vendor.sample"
8+
minSdkVersion 15
9+
targetSdkVersion 26
10+
versionCode 1
11+
versionName "1.0"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
implementation fileTree(dir: 'libs', include: ['*.jar'])
23+
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
24+
}

app/proguard-rules.pro

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Developer/AndroidSDK/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
18+
19+
# Uncomment this to preserve the line number information for
20+
# debugging stack traces.
21+
#-keepattributes SourceFile,LineNumberTable
22+
23+
# If you keep the line number information, uncomment this to
24+
# hide the original source file name.
25+
#-renamesourcefileattribute SourceFile

app/src/main/AndroidManifest.xml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.vendor.sample">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>

0 commit comments

Comments
 (0)