Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suhy07
Drift Bottle
比较版本
add2358259806b4714c6de874899b4c72cf67e04...a2a0d1cbe2d3e87814e823fb1680f59d9f5d6cfc
D
Drift Bottle
项目概览
suhy07
/
Drift Bottle
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Drift Bottle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
源分支
a2a0d1cbe2d3e87814e823fb1680f59d9f5d6cfc
选择Git版本
...
目标分支
add2358259806b4714c6de874899b4c72cf67e04
选择Git版本
比较
Commits (2)
https://gitcode.net/qq_45815609/drift-bottle/-/commit/f32680d95f94a67ffb44e51645fe38023287ab21
addView
2022-05-21T20:53:48+08:00
suhy
704722924@qq.com
https://gitcode.net/qq_45815609/drift-bottle/-/commit/a2a0d1cbe2d3e87814e823fb1680f59d9f5d6cfc
Merge remote-tracking branch 'origin/android' into android
2022-05-21T20:54:20+08:00
suhy
704722924@qq.com
# Conflicts: # MyHomeWork/.idea/misc.xml
隐藏空白更改
内联
并排
Showing
11 changed file
with
133 addition
and
189 deletion
+133
-189
MyHomeWork/.idea/deploymentTargetDropDown.xml
MyHomeWork/.idea/deploymentTargetDropDown.xml
+6
-6
MyHomeWork/.idea/inspectionProfiles/Project_Default.xml
MyHomeWork/.idea/inspectionProfiles/Project_Default.xml
+20
-0
MyHomeWork/.idea/misc.xml
MyHomeWork/.idea/misc.xml
+7
-8
MyHomeWork/app/src/main/java/com/example/myhomework/activity/MainActivity.java
...in/java/com/example/myhomework/activity/MainActivity.java
+12
-1
MyHomeWork/app/src/main/java/com/example/myhomework/view/TopBar.java
...app/src/main/java/com/example/myhomework/view/TopBar.java
+42
-90
MyHomeWork/app/src/main/res/layout/activity_main.xml
MyHomeWork/app/src/main/res/layout/activity_main.xml
+14
-14
MyHomeWork/app/src/main/res/layout/appbar.xml
MyHomeWork/app/src/main/res/layout/appbar.xml
+20
-46
MyHomeWork/app/src/main/res/layout/fragment_mine.xml
MyHomeWork/app/src/main/res/layout/fragment_mine.xml
+7
-15
MyHomeWork/app/src/main/res/menu/bottom_nav_menu.xml
MyHomeWork/app/src/main/res/menu/bottom_nav_menu.xml
+2
-2
MyHomeWork/app/src/main/res/navigation/mobile_navigation.xml
MyHomeWork/app/src/main/res/navigation/mobile_navigation.xml
+2
-2
MyHomeWork/app/src/main/res/values/attrs.xml
MyHomeWork/app/src/main/res/values/attrs.xml
+1
-5
未找到文件。
MyHomeWork/.idea/deploymentTargetDropDown.xml
浏览文件 @
a2a0d1cb
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"deploymentTargetDropDown"
>
<
t
argetSelectedWithDropDown>
<
runningDeviceT
argetSelectedWithDropDown>
<Target>
<type
value=
"
QUICK_BOOT
_TARGET"
/>
<type
value=
"
RUNNING_DEVICE
_TARGET"
/>
<deviceKey>
<Key>
<type
value=
"
VIRTUAL_DEVICE_PATH
"
/>
<value
value=
"
D:\Android\.android\avd\Pixel_5_API_29.avd
"
/>
<type
value=
"
SERIAL_NUMBER
"
/>
<value
value=
"
406885a5
"
/>
</Key>
</deviceKey>
</Target>
</
t
argetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown
value=
"202
1-12-19T21:18:04.317759800
Z"
/>
</
runningDeviceT
argetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown
value=
"202
2-05-21T12:44:01.317253
Z"
/>
</component>
</project>
\ No newline at end of file
MyHomeWork/.idea/inspectionProfiles/Project_Default.xml
0 → 100644
浏览文件 @
a2a0d1cb
<component
name=
"InspectionProjectProfileManager"
>
<profile
version=
"1.0"
>
<option
name=
"myName"
value=
"Project Default"
/>
<inspection_tool
class=
"PreviewAnnotationInFunctionWithParameters"
enabled=
"true"
level=
"ERROR"
enabled_by_default=
"true"
>
<option
name=
"previewFile"
value=
"true"
/>
</inspection_tool>
<inspection_tool
class=
"PreviewDimensionRespectsLimit"
enabled=
"true"
level=
"WARNING"
enabled_by_default=
"true"
>
<option
name=
"previewFile"
value=
"true"
/>
</inspection_tool>
<inspection_tool
class=
"PreviewMultipleParameterProviders"
enabled=
"true"
level=
"ERROR"
enabled_by_default=
"true"
>
<option
name=
"previewFile"
value=
"true"
/>
</inspection_tool>
<inspection_tool
class=
"PreviewMustBeTopLevelFunction"
enabled=
"true"
level=
"ERROR"
enabled_by_default=
"true"
>
<option
name=
"previewFile"
value=
"true"
/>
</inspection_tool>
<inspection_tool
class=
"PreviewNeedsComposableAnnotation"
enabled=
"true"
level=
"ERROR"
enabled_by_default=
"true"
>
<option
name=
"previewFile"
value=
"true"
/>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
MyHomeWork/.idea/misc.xml
浏览文件 @
a2a0d1cb
...
...
@@ -11,24 +11,17 @@
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/activity_register.xml"
value=
"0.18614130434782608"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/activity_update_photo.xml"
value=
"0.19927536231884058"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/activity_user_information.xml"
value=
"0.17980072463768115"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/add_message.xml"
value=
"0.
12
"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/add_message.xml"
value=
"0.
3081232492997199
"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/addmessage.xml"
value=
"0.17980072463768115"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/appbar.xml"
value=
"0.17980072463768115"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/bottle_details.xml"
value=
"0.176"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/draft_details.xml"
value=
"0.264"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/draft_item.xml"
value=
"0.1"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/drawer_header.xml"
value=
"0.17980072463768115"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_chat.xml"
value=
"0.17980072463768115"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_home.xml"
value=
"0.1598731884057971"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_news.xml"
value=
"0.17980072463768115"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_photo.xml"
value=
"0.17617753623188406"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/historyrecord_item.xml"
value=
"0.19927536231884058"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/message_details.xml"
value=
"0.4"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/message_item.xml"
value=
"0.17291666666666666"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/msg_left_layout.xml"
value=
"0.19927536231884058"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/msg_right_layout.xml"
value=
"0.19927536231884058"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/my_draft.xml"
value=
"0.17291666666666666"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/my_message.xml"
value=
"0.17291666666666666"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/recycler_item.xml"
value=
"0.19927536231884058"
/>
<entry
key=
"..\:/Users/71962/Desktop/drift-bottle/MyHomeWork/app/src/main/res/layout/userhead_item.xml"
value=
"0.19927536231884058"
/>
<entry
key=
"..\:/Users/suhy/Desktop/Android/MyHomeWork/app/src/main/res/drawable/ic_dashboard_black_24dp.xml"
value=
"0.1"
/>
...
...
@@ -69,6 +62,7 @@
<entry
key=
"..\:/Users/suhy/Desktop/github/Android/MyHomeWork/app/src/main/res/layout/fragment_news.xml"
value=
"0.19972826086956522"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/Android/MyHomeWork/app/src/main/res/layout/fragment_photo.xml"
value=
"0.16964285714285715"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/Android/MyHomeWork/app/src/main/res/layout/userhead_item.xml"
value=
"0.14791666666666667"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/drawable/ic_dashboard_black_24dp.xml"
value=
"0.2564814814814815"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/activity_ar.xml"
value=
"0.13858695652173914"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/activity_evalute.xml"
value=
"0.2"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/activity_historical_records.xml"
value=
"0.13858695652173914"
/>
...
...
@@ -81,8 +75,13 @@
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/add_message.xml"
value=
"0.4"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/appbar.xml"
value=
"0.264"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/drawer_header.xml"
value=
"0.13858695652173914"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_blank.xml"
value=
"0.16302083333333334"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_chat.xml"
value=
"0.13858695652173914"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_home.xml"
value=
"0.13858695652173914"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_item_list_dialog_list_dialog.xml"
value=
"0.2223731884057971"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_item_list_dialog_list_dialog_item.xml"
value=
"0.18541666666666667"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_map.xml"
value=
"0.1175925925925926"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_mine.xml"
value=
"0.176"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_news.xml"
value=
"0.11822916666666666"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/fragment_photo.xml"
value=
"0.13858695652173914"
/>
<entry
key=
"..\:/Users/suhy/Desktop/github/drift-bottle/MyHomeWork/app/src/main/res/layout/historyrecord_item.xml"
value=
"0.13858695652173914"
/>
...
...
MyHomeWork/app/src/main/java/com/example/myhomework/activity/MainActivity.java
浏览文件 @
a2a0d1cb
...
...
@@ -3,10 +3,15 @@ package com.example.myhomework.activity;
import
androidx.appcompat.app.ActionBar
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.drawerlayout.widget.DrawerLayout
;
import
androidx.navigation.NavController
;
import
androidx.navigation.Navigation
;
import
androidx.navigation.ui.AppBarConfiguration
;
import
androidx.navigation.ui.NavigationUI
;
import
android.os.Bundle
;
import
android.view.WindowManager
;
import
com.example.myhomework.R
;
import
com.example.myhomework.utils.PermissionsUtils
;
import
com.example.myhomework.databinding.ActivityMainBinding
;
...
...
@@ -41,8 +46,14 @@ public class MainActivity extends AppCompatActivity {
// NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
// NavigationUI.setupWithNavController(binding.navView, navController);
// //binding.navigationView.setCo
AppBarConfiguration
mAppBarConfiguration
=
new
AppBarConfiguration
.
Builder
(
R
.
id
.
page_map
,
R
.
id
.
page_mine
)
.
setOpenableLayout
(
drawerLayout
)
.
build
();
PermissionsUtils
.
verifyStoragePermissions
(
this
);
NavController
navController
=
Navigation
.
findNavController
(
this
,
R
.
id
.
nav_host_fragment_activity_main
);
NavigationUI
.
setupActionBarWithNavController
(
this
,
navController
,
mAppBarConfiguration
);
NavigationUI
.
setupWithNavController
(
binding
.
bottomNav
,
navController
);
}
private
void
hideActionBar
(){
...
...
MyHomeWork/app/src/main/java/com/example/myhomework/view/TopBar.java
浏览文件 @
a2a0d1cb
...
...
@@ -3,126 +3,78 @@ package com.example.myhomework.view;
import
android.content.Context
;
import
android.content.res.TypedArray
;
import
android.graphics.Color
;
import
android.graphics.drawable.Drawable
;
import
android.util.AttributeSet
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.FrameLayout
;
import
android.widget.ImageButton
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
com.example.myhomework.R
;
public
class
TopBar
extends
RelativeLayout
{
private
Button
mLeftButton
,
mRightButton
;
private
TextView
mTitleView
;
private
TopBarClickListener
topBarClickListener
;
private
ImageButton
backImageButton
;
private
TextView
titleTextView
;
public
TopBar
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
TypedArray
ta
=
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
TopBar
);
//获取自定义xml那些属性
int
mLeftTextColor
=
ta
.
getColor
(
R
.
styleable
.
TopBar_leftTextColor
,
0
);
//取出对应的值,如果不能存在默认值为0
Drawable
mBackground
=
ta
.
getDrawable
(
R
.
styleable
.
TopBar_background
);
String
mLeftText
=
ta
.
getString
(
R
.
styleable
.
TopBar_leftText
);
int
mRightTextColor
=
ta
.
getColor
(
R
.
styleable
.
TopBar_rightTextColor
,
0
);
Drawable
mRightBackground
=
ta
.
getDrawable
(
R
.
styleable
.
TopBar_rightBackground
);
String
mRightText
=
ta
.
getString
(
R
.
styleable
.
TopBar_rightText
);
int
backgroundColor
=
ta
.
getColor
(
R
.
styleable
.
TopBar_background
,
getResources
().
getColor
(
R
.
color
.
colorPrimaryVariant
));
setBackgroundColor
(
backgroundColor
);
int
titleTextColor
=
ta
.
getColor
(
R
.
styleable
.
TopBar_titleTextColor
,
Color
.
WHITE
);
float
titleTextSize
=
ta
.
getDimension
(
R
.
styleable
.
TopBar_titleTextSize
,
20
);
String
title
=
ta
.
getString
(
R
.
styleable
.
TopBar_title
);
boolean
flag
=
ta
.
getBoolean
(
R
.
styleable
.
TopBar_back
,
Boolean
.
TRUE
);
float
mTextSize
=
ta
.
getDimension
(
R
.
styleable
.
TopBar_titleTextSize
,
10
);
int
mTitleTextColor
=
ta
.
getColor
(
R
.
styleable
.
TopBar_titleTextColor
,
0
);
String
mTitle
=
ta
.
getString
(
R
.
styleable
.
TopBar_title
);
ta
.
recycle
();
//避免重建时发生错误 资源回收
mLeftButton
=
new
Button
(
context
);
mRightButton
=
new
Button
(
context
);
mTitleView
=
new
TextView
(
context
);
//赋值
mLeftButton
.
setText
(
mLeftText
);
//标题
mLeftButton
.
setTextColor
(
mLeftTextColor
);
mLeftButton
.
setBackground
(
mBackground
);
mRightButton
.
setTextColor
(
mRightTextColor
);
mRightButton
.
setBackground
(
mRightBackground
);
mRightButton
.
setText
(
mRightText
);
mTitleView
.
setText
(
mTitle
);
mTitleView
.
setTextColor
(
mTitleTextColor
);
mTitleView
.
setTextSize
(
mTextSize
);
mTitleView
.
setGravity
(
Gravity
.
CENTER
);
//布局
RelativeLayout
.
LayoutParams
mLeftParams
=
new
LayoutParams
(
LayoutParams
.
WRAP_CONTENT
,
LayoutParams
.
MATCH_PARENT
);
mLeftParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_LEFT
,
TRUE
);
addView
(
mLeftButton
,
mLeftParams
);
//添加到viewGroup
RelativeLayout
.
LayoutParams
mRightParams
=
new
LayoutParams
(
LayoutParams
.
WRAP_CONTENT
,
LayoutParams
.
MATCH_PARENT
);
mRightParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_RIGHT
,
TRUE
);
addView
(
mRightButton
,
mRightParams
);
//添加到viewGroup
RelativeLayout
.
LayoutParams
mTitleParams
=
new
LayoutParams
(
LayoutParams
.
WRAP_CONTENT
,
LayoutParams
.
MATCH_PARENT
);
mTitleParams
.
addRule
(
RelativeLayout
.
CENTER_IN_PARENT
,
TRUE
);
addView
(
mTitleView
,
mTitleParams
);
//添加到viewGroup
mRightButton
.
setOnClickListener
(
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
topBarClickListener
!=
null
){
topBarClickListener
.
rightClick
();
//右边点击事件
}
}
});
mLeftButton
.
setOnClickListener
(
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
topBarClickListener
!=
null
){
topBarClickListener
.
leftClick
();
//左边点击事件
}
titleTextView
=
new
TextView
(
context
);
titleTextView
.
setText
(
title
);
titleTextView
.
setGravity
(
Gravity
.
CENTER
);
titleTextView
.
setTextSize
(
titleTextSize
);
titleTextView
.
setTextColor
(
titleTextColor
);
LayoutParams
titleParams
=
new
LayoutParams
(
LayoutParams
.
WRAP_CONTENT
,
LayoutParams
.
WRAP_CONTENT
);
titleParams
.
addRule
(
RelativeLayout
.
CENTER_IN_PARENT
);
addView
(
titleTextView
,
titleParams
);
backImageButton
=
new
ImageButton
(
context
);
backImageButton
.
setBackgroundResource
(
R
.
drawable
.
left
);
LayoutParams
backParams
=
new
LayoutParams
(
100
,
80
);
backParams
.
addRule
(
RelativeLayout
.
CENTER_IN_PARENT
);
backParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_LEFT
);
backParams
.
setMarginStart
(
50
);
addView
(
backImageButton
,
backParams
);
backImageButton
.
setOnClickListener
(
v
->{
if
(
topBarClickListener
!=
null
){
topBarClickListener
.
Click
();
//右边点击事件
}
});
}
//
if
(!
flag
)
backImageButton
.
setVisibility
(
INVISIBLE
);
/**
* 是否隐藏或者显示
* @param id 0 显示 其他为隐藏
* @param flag ture 显示 false 隐藏
*/
public
void
setButtonVisible
(
int
id
,
boolean
flag
){
if
(
flag
){
if
(
id
==
0
){
mLeftButton
.
setVisibility
(
VISIBLE
);
}
else
{
mRightButton
.
setVisibility
(
VISIBLE
);
}
}
else
{
if
(
id
==
0
){
mLeftButton
.
setVisibility
(
GONE
);
}
else
{
mRightButton
.
setVisibility
(
GONE
);
}
}
}
/**
* 暴露一个方法实现调用者来注册接口回调
* @param topBarClickListener
*/
public
void
setTopBarClickListener
(
TopBarClickListener
topBarClickListener
)
{
this
.
topBarClickListener
=
topBarClickListener
;
}
//定义接口
public
interface
TopBarClickListener
{
/**
* 左按钮点击事件
*/
void
leftClick
();
/**
* 右按钮点击事件
*/
void
rightClick
();
void
Click
();
}
}
\ No newline at end of file
MyHomeWork/app/src/main/res/layout/activity_main.xml
浏览文件 @
a2a0d1cb
...
...
@@ -41,7 +41,7 @@
</com.example.myhomework.view.RadiusCardView>
<ImageButton
android:id=
"@+id/
imageButton2
"
android:id=
"@+id/
btn_add
"
android:layout_width=
"100dp"
android:layout_height=
"100dp"
android:background=
"@color/transparent"
...
...
@@ -56,18 +56,18 @@
app:srcCompat=
"@drawable/add_btn"
/>
<
!-- <fragment-->
<!-- android:id="@+id/nav_host_fragment_activity_main"-->
<!-- android:name="androidx.navigation.fragment.NavHostFragment"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- app:defaultNavHost="true"-->
<!-- app:layout_constraintBottom_toTopOf="@id/nav_view"-->
<!-- app:layout_constraintHorizontal_bias="1.0"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:layout_constraintVertical_bias="1.0"-->
<!-- app:navGraph="@navigation/mobile_navigation" />--
>
<
fragment
android:id=
"@+id/nav_host_fragment_activity_main"
android:name=
"androidx.navigation.fragment.NavHostFragment"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:defaultNavHost=
"true"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintHorizontal_bias=
"1.0"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"1.0"
app:navGraph=
"@navigation/mobile_navigation"
/
>
</androidx.constraintlayout.widget.ConstraintLayout>
MyHomeWork/app/src/main/res/layout/appbar.xml
浏览文件 @
a2a0d1cb
<?xml version="1.0" encoding="utf-8"?>
<
Fram
eLayout
<
Relativ
eLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
>
android:layout_height=
"50dp"
android:background=
"@color/colorPrimary"
>
<com.google.android.material.appbar.AppBarLayout
android:layout_width=
"match_parent"
<TextView
android:id=
"@+id/textview_toolbar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
android:layout_centerInParent=
"true"
android:gravity=
"center"
android:text=
"添加漂流瓶"
android:textColor=
"@color/white"
android:textSize=
"20sp"
/>
<androidx.appcompat.widget.Toolbar
android:id=
"@+id/toolbar"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:background=
"@color/colorPrimary"
>
<ImageButton
android:id=
"@+id/imageButton_left_toolbar"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_centerInParent=
"true"
android:layout_alignParentLeft=
"true"
android:layout_marginStart=
"10dp"
android:background=
"@drawable/left"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<TextView
android:id=
"@+id/textview_toolbar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:gravity=
"center"
android:text=
"添加漂流瓶"
android:textColor=
"@color/white"
android:textSize=
"20sp"
/>
<ImageButton
android:id=
"@+id/imageButton_left_toolbar"
android:layout_width=
"38dp"
android:layout_height=
"30dp"
android:layout_alignParentStart=
"true"
android:layout_alignParentLeft=
"true"
android:layout_alignParentTop=
"true"
android:layout_alignParentEnd=
"true"
android:layout_alignParentBottom=
"true"
android:layout_marginStart=
"2dp"
android:layout_marginLeft=
"2dp"
android:layout_marginTop=
"12dp"
android:layout_marginEnd=
"355dp"
android:layout_marginBottom=
"8dp"
android:background=
"@drawable/left"
/>
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
</FrameLayout>
\ No newline at end of file
</RelativeLayout>
MyHomeWork/app/src/main/res/layout/fragment_mine.xml
浏览文件 @
a2a0d1cb
...
...
@@ -9,23 +9,15 @@
>
<com.example.myhomework.view.TopBar
android:id=
"@+id/topBar"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:id=
"@+id/topBar"
app:background=
"@drawable/ic_launcher_background"
app:leftText=
"菜单"
app:leftTextColor=
"#666666"
app:title=
"未标题"
app:titleTextColor=
"#333333"
app:titleTextSize=
"10sp"
app:rightBackground=
"@drawable/ic_launcher_background"
app:rightText=
"菜单"
app:rightTextColor=
"#666666"
>
app:back=
"false"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:title=
"我的主页"
tools:ignore=
"MissingConstraints"
/>
</com.example.myhomework.view.TopBar>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
MyHomeWork/app/src/main/res/menu/bottom_nav_menu.xml
浏览文件 @
a2a0d1cb
...
...
@@ -2,12 +2,12 @@
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<group
android:checkableBehavior=
"single"
>
<item
android:id=
"@+id/page_
news
"
android:id=
"@+id/page_
map
"
android:icon=
"@drawable/map"
android:title=
"@string/title_main"
/>
<item
android:id=
"@+id/page_
photo
"
android:id=
"@+id/page_
mine
"
android:icon=
"@drawable/user"
android:title=
"@string/title_second"
/>
</group>
...
...
MyHomeWork/app/src/main/res/navigation/mobile_navigation.xml
浏览文件 @
a2a0d1cb
...
...
@@ -3,7 +3,7 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/mobile_navigation"
app:startDestination=
"@+id/page_
news
"
>
app:startDestination=
"@+id/page_
map
"
>
<fragment
android:id=
"@+id/page_map"
...
...
@@ -12,7 +12,7 @@
tools:layout=
"@layout/fragment_map"
/>
<fragment
android:id=
"@+id/page_
photo
"
android:id=
"@+id/page_
mine
"
android:name=
"com.example.myhomework.fragment.MineFragment"
android:label=
"@string/title_second"
tools:layout=
"@layout/fragment_mine"
/>
...
...
MyHomeWork/app/src/main/res/values/attrs.xml
浏览文件 @
a2a0d1cb
...
...
@@ -5,11 +5,7 @@
<attr
name=
"titleTextSize"
format=
"dimension"
/>
<attr
name=
"titleTextColor"
format=
"color"
/>
<attr
name=
"background"
format=
"reference"
/>
<attr
name=
"leftTextColor"
format=
"color"
/>
<attr
name=
"leftText"
format=
"string"
/>
<attr
name=
"rightTextColor"
format=
"color"
/>
<attr
name=
"rightBackground"
format=
"reference"
/>
<attr
name=
"rightText"
format=
"string"
/>
<attr
name=
"back"
format=
"boolean"
/>
</declare-styleable>
<declare-styleable
name=
"RadiusCardView"
>
<!-- 左上圆角大小-->
...
...