Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
eb96bce6
Commit
eb96bce6
authored
Aug 12, 2022
by
刘鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 首页金刚位UI根据设计要求修改文字居中展示
parent
901d7e61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
83 deletions
+83
-83
HomeButtonBannerView.kt
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeButtonBannerView.kt
+0
-37
home_button_banner_view.xml
m-home/src/ydl/res/layout/home_button_banner_view.xml
+83
-46
No files found.
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeButtonBannerView.kt
View file @
eb96bce6
...
...
@@ -3,15 +3,10 @@ package com.yidianling.home.ui.view
import
android.content.Context
import
android.view.View
import
android.view.ViewGroup
import
android.widget.FrameLayout
import
android.widget.LinearLayout
import
androidx.constraintlayout.widget.ConstraintLayout
import
androidx.constraintlayout.widget.ConstraintSet
import
androidx.recyclerview.widget.RecyclerView
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.yidianling.common.tools.RxDeviceTool
import
com.yidianling.common.tools.RxImageTool
import
com.yidianling.home.R
import
com.yidianling.home.event.IHomeBaseEvent
import
kotlinx.android.synthetic.ydl.home_button_banner_view.view.*
...
...
@@ -28,11 +23,6 @@ class HomeButtonBannerView(
private
var
homeEvent
:
IHomeBaseEvent
?,
var
listenFree
:
Boolean
)
:
LinearLayout
(
mContext
)
{
private
var
buttonParams
:
LinearLayout
.
LayoutParams
?
=
null
private
var
buttonParamsFrame
:
FrameLayout
.
LayoutParams
?
=
null
private
var
buttonParamsFrame2
:
FrameLayout
.
LayoutParams
?
=
null
init
{
initView
()
}
...
...
@@ -59,8 +49,6 @@ class HomeButtonBannerView(
.
load
(
R
.
drawable
.
qingsu_new_free_dynamic
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
RESOURCE
)
.
into
(
qingsuGif
)
initButtonView
()
homeModuleButtonBannerFirst
.
setOnClickListener
{
homeEvent
?.
reservationExpertsClick
()
}
...
...
@@ -74,28 +62,4 @@ class HomeButtonBannerView(
homeEvent
?.
psychologyTestClick
()
}
}
/**
* 初始化四个按钮
*/
private
fun
initButtonView
()
{
if
(
null
==
buttonParams
)
{
val
screenWidth
=
RxDeviceTool
.
getScreenWidth
(
mContext
)
// val viewWidth = ((screenWidth - 2 * 9 * RxDeviceTool.getScreenDensity(mContext)) / 4).toInt()
val
viewWidth
=
screenWidth
/
4
-
40
val
viewHeight
=
viewWidth
buttonParams
=
LinearLayout
.
LayoutParams
(
viewWidth
,
viewHeight
)
buttonParams
!!
.
setMargins
(
0
,
0
,
20
,
0
)
buttonParamsFrame
=
FrameLayout
.
LayoutParams
(
viewWidth
,
viewHeight
)
buttonParamsFrame2
=
FrameLayout
.
LayoutParams
((
viewWidth
/
2.0
).
toInt
(),
(
viewHeight
/
2.3
).
toInt
())
// buttonParamsFrame2!!.setMargins((((viewWidth / 20f).toInt())), 0, 0, 0)
qingsuGif
.
layoutParams
=
buttonParamsFrame2
homeModuleButtonBannerFirst
.
layoutParams
=
buttonParams
homeModuleButtonBannerFourth
.
layoutParams
=
buttonParams
homeModuleButtonBannerSecond
.
layoutParams
=
buttonParams
homeModuleButtonBannerThird
.
layoutParams
=
buttonParams
homeModuleButtonBannerSecondFrame
.
layoutParams
=
buttonParamsFrame
}
}
}
\ No newline at end of file
m-home/src/ydl/res/layout/home_button_banner_view.xml
View file @
eb96bce6
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/four_button_constrain"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
@@ -9,16 +8,17 @@
android:orientation=
"horizontal"
android:paddingLeft=
"@dimen/platform_dp_8"
android:paddingTop=
"@dimen/platform_dp_8"
>
android:paddingRight=
"8dp"
>
<
Relative
Layout
<
androidx.constraintlayout.widget.Constraint
Layout
android:id=
"@+id/homeModuleButtonBannerFirst"
android:layout_width=
"0dp"
android:layout_height=
"78dp"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"1"
android:background=
"@drawable/home_button_banner_first_img_new"
android:gravity=
"center"
android:paddingRight=
"@dimen/platform_dp_8"
>
android:gravity=
"center"
>
<TextView
android:id=
"@+id/homeModuleButtonBannerFirstTitle"
...
...
@@ -27,25 +27,36 @@
android:text=
"心理咨询"
android:textColor=
"@color/color_1C1F28"
android:textSize=
"15sp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
app:layout_constraintBottom_toTopOf=
"@id/homeModuleFirstDec"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_chainStyle=
"packed"
/>
<TextView
android:id=
"@+id/homeModuleFirstDec"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/homeModuleButtonBannerFirstTitle"
android:text=
"3W+师资"
android:textColor=
"@color/color_1C1F28"
android:textSize=
"@dimen/platform_sp_12"
/>
</RelativeLayout>
android:textSize=
"@dimen/platform_sp_12"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/homeModuleButtonBannerFirstTitle"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<
Relative
Layout
<
androidx.constraintlayout.widget.Constraint
Layout
android:id=
"@+id/homeModuleButtonBannerFourth"
android:layout_width=
"0dp"
android:layout_height=
"78dp"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"1"
android:background=
"@drawable/home_confide_free_icon"
android:gravity=
"center"
android:paddingRight=
"@dimen/platform_dp_8"
>
android:gravity=
"center"
>
<TextView
android:id=
"@+id/homeModuleButtonBannerFourthTitle"
...
...
@@ -54,26 +65,36 @@
android:text=
"心理测试"
android:textColor=
"@color/color_1C1F28"
android:textSize=
"15sp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
app:layout_constraintBottom_toTopOf=
"@id/homeModuleButtonBannerFourthdec"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_chainStyle=
"packed"
/>
<TextView
android:id=
"@+id/homeModuleButtonBannerFourthdec"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/homeModuleButtonBannerFourthTitle"
android:text=
"抑郁测量"
android:textColor=
"@color/color_1C1F28"
android:textSize=
"@dimen/platform_sp_12"
/>
</RelativeLayout>
android:textSize=
"@dimen/platform_sp_12"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/homeModuleButtonBannerFourthTitle"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<
Relative
Layout
<
androidx.constraintlayout.widget.Constraint
Layout
android:id=
"@+id/homeModuleButtonBannerThird"
android:layout_width=
"0dp"
android:layout_height=
"78dp"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"1"
android:background=
"@drawable/home_button_banner_third_img_new"
android:gravity=
"center"
android:orientation=
"vertical"
android:paddingRight=
"@dimen/platform_dp_8"
>
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/homeModuleButtonBannerThirdTitle"
...
...
@@ -82,53 +103,69 @@
android:text=
"心理课堂"
android:textColor=
"@color/color_1C1F28"
android:textSize=
"15sp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
app:layout_constraintBottom_toTopOf=
"@id/homeModuleButtonBannerThirdDec"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_chainStyle=
"packed"
/>
<TextView
android:id=
"@+id/homeModuleButtonBannerThirdDec"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/homeModuleButtonBannerThirdTitle"
android:text=
"学习与成长"
android:textColor=
"@color/color_1C1F28"
android:textSize=
"@dimen/platform_sp_12"
/>
</RelativeLayout>
android:textSize=
"@dimen/platform_sp_12"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/homeModuleButtonBannerThirdTitle"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<
Frame
Layout
<
androidx.constraintlayout.widget.Constraint
Layout
android:id=
"@+id/homeModuleButtonBannerSecond"
android:layout_width=
"0dp"
android:layout_height=
"78dp"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"4dp"
android:layout_weight=
"1"
android:background=
"@drawable/home_button_banner_fourth_img_new"
>
<RelativeLayout
android:id=
"@+id/homeModuleButtonBannerSecondFrame"
android:layout_width=
"78dp"
android:layout_height=
"78dp"
android:gravity=
"center"
android:paddingRight=
"@dimen/platform_dp_8"
>
<TextView
android:id=
"@+id/homeModuleButtonBannerSecondTitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"倾诉热线"
android:textColor=
"@color/color_1C1F28"
android:textSize=
"15sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/homeModuleButtonBannerSecondTitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"倾诉热线"
android:textColor=
"@color/color_1C1F28"
android:textSize=
"15sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toTopOf=
"@id/homeModuleButtonBannerSecondDec"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_chainStyle=
"packed"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/homeModuleButtonBannerSecondTitle"
android:text=
"温暖守护您"
android:textColor=
"@color/color_1C1F28"
android:textSize=
"@dimen/platform_sp_12"
/>
</RelativeLayout>
<TextView
android:id=
"@+id/homeModuleButtonBannerSecondDec"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"温暖守护您"
android:textColor=
"@color/color_1C1F28"
android:textSize=
"@dimen/platform_sp_12"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/homeModuleButtonBannerSecondTitle"
/>
<ImageView
android:id=
"@+id/qingsuGif"
android:layout_width=
"45dp"
android:layout_height=
"@dimen/platform_dp_22"
android:visibility=
"visible"
/>
</FrameLayout>
android:visibility=
"visible"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment