mirror of
https://github.com/ZCShou/GoGoGo.git
synced 2026-06-13 21:00:55 +08:00
改进了离线地图页面,增加返回按钮
This commit is contained in:
parent
f22d362431
commit
ca24d5a918
@ -6,9 +6,13 @@ import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
public class OfflineMapActivity extends FragmentActivity {
|
||||
|
||||
ImageButton btnBack;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Log.d("OfflineMapActivity", "onCreate");
|
||||
@ -22,10 +26,19 @@ public class OfflineMapActivity extends FragmentActivity {
|
||||
viewPager.setAdapter(pagerAdapter);
|
||||
|
||||
TabLayout tabLayout = findViewById(R.id.sliding_tabs);
|
||||
tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
tabLayout.setTabMode(TabLayout.MODE_FIXED);
|
||||
btnBack = findViewById(R.id.back);
|
||||
// btnBack.setImageResource(R.drawable.ic_run);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void goHome(View view) {
|
||||
this.finish(); // back button
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
Log.d("OfflineMapActivity", "onDestroy");
|
||||
|
||||
9
app/src/main/res/drawable/ic_back.xml
Normal file
9
app/src/main/res/drawable/ic_back.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="128dp"
|
||||
android:height="128dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M941.3,553.2 L240.41,553.2l347.2,347.2 -58.26,58.26L82.7,512 529.35,65.35l58.26,58.26 -347.2,347.2 700.89,0L941.3,553.2zM199.22,512l0.57,0.57 0,-1.14L199.22,512z"/>
|
||||
</vector>
|
||||
@ -1,13 +1,37 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/sliding_tabs"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cadetblue"
|
||||
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/sliding_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabTextAppearance="@style/TabLayout.Bar.Txt"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:onClick="goHome"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/map_home"
|
||||
android:src="@drawable/ic_back"
|
||||
android:theme="@style/RippleWhite" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
|
||||
@ -25,4 +25,15 @@
|
||||
<item name="android:radius">14dp</item>
|
||||
</style>
|
||||
|
||||
<!-- 修改tablayout的背景色,提示线的颜色,字体颜色等-->
|
||||
<style name="TabLayout.Bar" parent="AppTheme">
|
||||
<item name="tabBackground">@color/cadetblue</item>
|
||||
<item name="tabTextAppearance">@style/TabLayout.Bar.Txt</item>
|
||||
<item name="tabSelectedTextColor">#3D87FB</item>
|
||||
</style>
|
||||
|
||||
<style name="TabLayout.Bar.Txt" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
|
||||
<item name="android:textSize">15sp</item>
|
||||
<item name="android:textColor">@color/white</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user