drawer
This commit is contained in:
@@ -52,4 +52,8 @@ dependencies {
|
||||
|
||||
//spring
|
||||
implementation 'com.jaredrummler:material-spinner:1.3.1'
|
||||
|
||||
//drawer
|
||||
implementation 'com.mxn.soul:flowingdrawer-core:2.1.0'
|
||||
implementation 'com.nineoldandroids:library:2.4.0'
|
||||
}
|
||||
|
||||
@@ -7,16 +7,14 @@ import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.BottomNavigationView;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.SpinnerAdapter;
|
||||
|
||||
import com.jaredrummler.materialspinner.MaterialSpinner;
|
||||
import com.jaredrummler.materialspinner.MaterialSpinnerAdapter;
|
||||
import com.mxn.soul.flowingdrawer_core.FlowingDrawer;
|
||||
import com.mxn.soul.flowingdrawer_core.FlowingMenuLayout;
|
||||
import com.scorpiomiku.oldpeoplehome.R;
|
||||
import com.scorpiomiku.oldpeoplehome.adapter.PeopleSpinnerAdapter;
|
||||
import com.scorpiomiku.oldpeoplehome.base.BaseActivity;
|
||||
@@ -24,16 +22,15 @@ import com.scorpiomiku.oldpeoplehome.base.BaseFragment;
|
||||
import com.scorpiomiku.oldpeoplehome.modules.children.fragment.EnvironmentFragment;
|
||||
import com.scorpiomiku.oldpeoplehome.modules.children.fragment.HeartRateFragment;
|
||||
import com.scorpiomiku.oldpeoplehome.modules.children.fragment.MapFragment;
|
||||
import com.scorpiomiku.oldpeoplehome.modules.children.fragment.MyInformationFragment;
|
||||
import com.scorpiomiku.oldpeoplehome.modules.children.fragment.SleepFragment;
|
||||
import com.scorpiomiku.oldpeoplehome.modules.children.fragment.StepFragment;
|
||||
import com.scorpiomiku.oldpeoplehome.utils.LogUtils;
|
||||
import com.scorpiomiku.oldpeoplehome.utils.StatusBarUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2019/8/21.
|
||||
@@ -48,6 +45,12 @@ public class ChildMainActivity extends BaseActivity {
|
||||
BottomNavigationView navigation;
|
||||
@BindView(R.id.tool_bar)
|
||||
LinearLayout toolBar;
|
||||
@BindView(R.id.avatar)
|
||||
ImageView avatar;
|
||||
@BindView(R.id.menu_layout)
|
||||
FlowingMenuLayout menuLayout;
|
||||
@BindView(R.id.drawerlayout)
|
||||
FlowingDrawer drawerlayout;
|
||||
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener;
|
||||
private FragmentManager fragmentManager;
|
||||
private BaseFragment[] fragments = {
|
||||
@@ -145,7 +148,7 @@ public class ChildMainActivity extends BaseActivity {
|
||||
fragmentTransaction.hide(fragments[4]);
|
||||
fragmentTransaction.commit();
|
||||
StatusBarUtils.setWindowStatusBarColor(this, barColors[0]);
|
||||
// spinner.setBackgroundColor(toolBarColors[0]);
|
||||
spinner.setBackgroundColor(toolBarColors[0]);
|
||||
toolBar.setBackgroundColor(toolBarColors[0]);
|
||||
}
|
||||
|
||||
@@ -160,7 +163,7 @@ public class ChildMainActivity extends BaseActivity {
|
||||
if (i == index) {
|
||||
fragmentTransaction.show(fragments[i]);
|
||||
StatusBarUtils.setWindowStatusBarColor(this, barColors[i]);
|
||||
// spinner.setBackgroundColor(toolBarColors[i]);
|
||||
spinner.setBackgroundColor(toolBarColors[i]);
|
||||
toolBar.setBackgroundColor(toolBarColors[i]);
|
||||
} else {
|
||||
fragmentTransaction.hide(fragments[i]);
|
||||
@@ -183,4 +186,9 @@ public class ChildMainActivity extends BaseActivity {
|
||||
= new PeopleSpinnerAdapter(getApplication(), oldPeopleList);
|
||||
spinner.setAdapter(adapter);
|
||||
}
|
||||
|
||||
@OnClick(R.id.avatar)
|
||||
public void onViewClicked() {
|
||||
drawerlayout.openMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,83 +1,119 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.mxn.soul.flowingdrawer_core.FlowingDrawer 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/drawerlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
app:edMenuBackground="#FFF"
|
||||
app:edMenuSize="230dp"
|
||||
app:edPosition="1"
|
||||
tools:context="com.scorpiomiku.oldpeoplehome.modules.oldpeople.activity.OldPeopleMainActivity">
|
||||
|
||||
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
app:contentInsetStart="0dp">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tool_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
tools:background="@color/colorPrimary">
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="2019-8-21"
|
||||
android:textColor="@color/white_text"
|
||||
android:textSize="16sp" />
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
app:contentInsetStart="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="220dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:id="@+id/tool_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center"
|
||||
android:text="选择老人:"
|
||||
android:textColor="@color/white_text"
|
||||
android:textSize="16sp" />
|
||||
android:orientation="horizontal"
|
||||
tools:background="@color/colorPrimary">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="match_parent"
|
||||
app:cardCornerRadius="10dp">
|
||||
<RelativeLayout
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
app:cardCornerRadius="15dp">
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/test_avatar" />
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="2019-8-21"
|
||||
android:textColor="@color/white_text"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="220dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center"
|
||||
android:text="选择老人:"
|
||||
android:textColor="@color/white_text"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.design.widget.BottomNavigationView
|
||||
android:id="@+id/navigation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:layout_marginStart="0dp"
|
||||
android:background="?android:attr/windowBackground"
|
||||
app:menu="@menu/childmain" />
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.design.widget.BottomNavigationView
|
||||
android:id="@+id/navigation"
|
||||
<com.mxn.soul.flowingdrawer_core.FlowingMenuLayout
|
||||
android:id="@+id/menu_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:layout_marginStart="0dp"
|
||||
android:background="?android:attr/windowBackground"
|
||||
app:menu="@menu/childmain" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</LinearLayout>
|
||||
</com.mxn.soul.flowingdrawer_core.FlowingMenuLayout>
|
||||
|
||||
</com.mxn.soul.flowingdrawer_core.FlowingDrawer>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:background="#00000000"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
|
||||
@@ -11,6 +12,7 @@
|
||||
android:id="@+id/spinner_avatar"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/test_avatar" />
|
||||
|
||||
@@ -19,6 +21,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_name" />
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/text_gray" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -17,4 +17,6 @@
|
||||
<color name="sleep_shallow">#4766e4</color>
|
||||
<color name="sleep_no">#7096cc</color>
|
||||
<color name="white_text">#FFF</color>
|
||||
|
||||
<color name="text_gray">#999494</color>
|
||||
</resources>
|
||||
|
||||
@@ -8,4 +8,10 @@
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="SpinnerStyle">
|
||||
<item name="colorAccent">#2f2a94</item>
|
||||
<item name="colorControlNormal">#ddf16565</item> <!--改变了spinner的颜色 -->
|
||||
</style>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user