Commit ce26434c60a4b1228a0cc9d66c6489e17b0846db
1 parent
116a57e2
Exists in
yxb_dev
and in
2 other branches
no message
Showing
6 changed files
with
44 additions
and
14 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/ui/MainActivity.java
| 1 | package com.shunzhi.parent.ui; | 1 | package com.shunzhi.parent.ui; |
| 2 | 2 | ||
| 3 | import android.support.annotation.NonNull; | 3 | import android.support.annotation.NonNull; |
| 4 | +import android.support.design.widget.BottomNavigationView; | ||
| 4 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
| 5 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 6 | 7 | ||
| 7 | import com.share.mvpsdk.base.BasePresenter; | 8 | import com.share.mvpsdk.base.BasePresenter; |
| 9 | +import com.share.mvpsdk.base.activity.BaseCompatActivity; | ||
| 8 | import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; | 10 | import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; |
| 11 | +import com.share.mvpsdk.helper.BottomNavigationViewHelper; | ||
| 9 | import com.shunzhi.parent.R; | 12 | import com.shunzhi.parent.R; |
| 10 | 13 | ||
| 11 | -public class MainActivity extends BaseMVPCompatActivity { | 14 | +import butterknife.BindView; |
| 15 | + | ||
| 16 | +public class MainActivity extends BaseCompatActivity { | ||
| 17 | + | ||
| 18 | + @BindView(R.id.bottom_navigationView) | ||
| 19 | + BottomNavigationView bottom_navigationView; | ||
| 12 | 20 | ||
| 13 | @Override | 21 | @Override |
| 14 | protected void initView(Bundle savedInstanceState) { | 22 | protected void initView(Bundle savedInstanceState) { |
| 15 | 23 | ||
| 24 | + BottomNavigationViewHelper.disableShiftMode(bottom_navigationView); | ||
| 25 | + | ||
| 26 | + bottom_navigationView.setSelectedItemId(R.id.bottom_navigationView); | ||
| 27 | + | ||
| 16 | } | 28 | } |
| 17 | 29 | ||
| 18 | @Override | 30 | @Override |
| @@ -20,9 +32,4 @@ public class MainActivity extends BaseMVPCompatActivity { | @@ -20,9 +32,4 @@ public class MainActivity extends BaseMVPCompatActivity { | ||
| 20 | return R.layout.activity_main; | 32 | return R.layout.activity_main; |
| 21 | } | 33 | } |
| 22 | 34 | ||
| 23 | - @NonNull | ||
| 24 | - @Override | ||
| 25 | - public BasePresenter initPresenter() { | ||
| 26 | - return null; | ||
| 27 | - } | ||
| 28 | } | 35 | } |
1.04 KB
1.03 KB
| @@ -0,0 +1,8 @@ | @@ -0,0 +1,8 @@ | ||
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | + | ||
| 4 | + <item android:drawable="@drawable/ceping_select" android:state_selected="true"/> | ||
| 5 | + <item android:drawable="@drawable/ceping_select" android:state_pressed="true"/> | ||
| 6 | + <item android:drawable="@drawable/ceping_normal"/> | ||
| 7 | + | ||
| 8 | +</selector> | ||
| 0 | \ No newline at end of file | 9 | \ No newline at end of file |
app/src/main/res/layout/activity_main.xml
| @@ -6,13 +6,19 @@ | @@ -6,13 +6,19 @@ | ||
| 6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
| 7 | tools:context="com.shunzhi.parent.ui.MainActivity"> | 7 | tools:context="com.shunzhi.parent.ui.MainActivity"> |
| 8 | 8 | ||
| 9 | - <TextView | ||
| 10 | - android:layout_width="wrap_content" | ||
| 11 | - android:layout_height="wrap_content" | ||
| 12 | - android:text="Hello World!" | ||
| 13 | - app:layout_constraintBottom_toBottomOf="parent" | ||
| 14 | - app:layout_constraintLeft_toLeftOf="parent" | ||
| 15 | - app:layout_constraintRight_toRightOf="parent" | ||
| 16 | - app:layout_constraintTop_toTopOf="parent" /> | 9 | + <FrameLayout |
| 10 | + android:layout_width="match_parent" | ||
| 11 | + android:layout_height="match_parent" | ||
| 12 | + android:layout_marginBottom="?android:actionBarSize" | ||
| 13 | + android:id="@+id/frame" | ||
| 14 | + ></FrameLayout> | ||
| 15 | + | ||
| 16 | + <android.support.design.widget.BottomNavigationView | ||
| 17 | + android:layout_width="match_parent" | ||
| 18 | + android:layout_height="?android:actionBarSize" | ||
| 19 | + android:background="@color/window_background_light" | ||
| 20 | + android:id="@+id/bottom_navigationView" | ||
| 21 | + android:layout_gravity="bottom" | ||
| 22 | + ></android.support.design.widget.BottomNavigationView> | ||
| 17 | 23 | ||
| 18 | </FrameLayout> | 24 | </FrameLayout> |
| @@ -0,0 +1,9 @@ | @@ -0,0 +1,9 @@ | ||
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<menu xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | + | ||
| 4 | + <item android:id="@+id/menu_item_index" | ||
| 5 | + android:icon="@drawable/selector_ceping" | ||
| 6 | + android:title="测评" | ||
| 7 | + ></item> | ||
| 8 | + | ||
| 9 | +</menu> | ||
| 0 | \ No newline at end of file | 10 | \ No newline at end of file |