Skip to content

Commit

Permalink
Trying to fix spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
w9jds committed Mar 3, 2016
1 parent c352099 commit 10402a2
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.Spinner;
Expand Down Expand Up @@ -54,6 +56,13 @@ public void onCreate(Bundle savedInstanceState) {
ButterKnife.bind(this);

Toolbar toolbar = ButterKnife.findById(this, R.id.main_toolbar);

// View spinnerContainer = LayoutInflater.from(this).inflate(R.layout.toolbar_spinner, toolbar, false);
// ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT,
// ActionBar.LayoutParams.MATCH_PARENT);
// toolbar.addView(spinnerContainer, layoutParams);
// regionSpinner = ButterKnife.findById(spinnerContainer, R.id.region_spinner);

setSupportActionBar(toolbar);
actionBar = getSupportActionBar();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* Created by Jeremy Shore on 3/3/16.
*/
public class TypeInfoTab extends Fragment implements BaseDataManager.DataLoadingCallbacks {
public final class TypeInfoTab extends Fragment implements BaseDataManager.DataLoadingCallbacks {

static final String ARG_PAGE = "ARG_PAGE";
static final String ARG_TYPEID = "ARG_TYPEID";
Expand Down
21 changes: 8 additions & 13 deletions app/src/main/res/layout/activity_market_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,37 @@
android:id="@+id/content_pager"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"/>

<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
style="@style/Widget.MarketBot.Toolbar.ItemToolbar">
style="@style/Widget.MarketBot.Toolbar.ItemToolbar"
android:elevation="4dp">

<android.support.v7.widget.Toolbar
android:id="@+id/main_toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
app:layout_scrollFlags="scroll|enterAlways"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

<Spinner
android:id="@+id/region_spinner"
style="@style/Widget.MarketBot.HeaderBar.Spinner"

style="@style/Widget.Light.Spinner"
android:dropDownWidth="200dp"
android:background="@null"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>

</android.support.v7.widget.Toolbar>

<android.support.design.widget.TabLayout
android:id="@+id/sliding_tabs"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:animateLayoutChanges="true"
android:background="@color/primary"
app:tabIndicatorHeight="2dp"
app:tabIndicatorColor="@android:color/white"
app:tabMode="scrollable" />
app:tabIndicatorColor="@android:color/white" />

</android.support.design.widget.AppBarLayout>

Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/layout/toolbar_spinner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent">

<Spinner
android:id="@+id/region_spinner"
style="@style/Widget.Light.Spinner"
android:background="@null"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>

</LinearLayout>
16 changes: 11 additions & 5 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,27 @@
<!--<item name="android:windowEnterTransition">@transition/home_enter</item>-->
</style>

<style name="Widget.MarketBot.HeaderBar.Spinner" parent="Widget.AppCompat.Light.Spinner.DropDown.ActionBar">
<style name="Widget.Light.Spinner" parent="Widget.AppCompat.Light.Spinner.DropDown.ActionBar">
<item name="android:background">?android:selectableItemBackground</item>
<item name="android:dropDownSelector">?android:selectableItemBackground</item>
<item name="android:dropDownWidth">?android:dropDownWidth</item>
<item name="android:topOffset">-16dp</item>
<item name="android:divider">@null</item>
<item name="android:overlapAnchor">true</item>
<item name="android:gravity">left</item>

<!--<item name="android:dropDownSelector">?android:selectableItemBackground</item>-->
<!--<item name="android:spinnerDropDownItemStyle">?attr/spinnerDropDownItemStyle</item>-->
<!--<item name="android:dropDownWidth">?android:dropDownWidth</item>-->
<!--<item name="android:divider">@null</item>-->
<!--<item name="android:overlapAnchor">true</item>-->
<!--<item name="android:gravity">left</item>-->
<!--<item name="android:background">@android:color/white</item>-->
<item name="android:popupBackground">@android:color/white</item>
<!--<item name="android:popupBackground">@android:color/white</item>-->
</style>

<style name="Widget.MarketBot.Toolbar" parent="Widget.AppCompat.Toolbar">
<item name="titleTextAppearance">@android:style/TextAppearance.Material.Widget.ActionBar.Title</item>
<item name="android:background">@color/primary</item>
<item name="android:theme">@style/MarketBotDarkOverlay</item>
<item name="android:minHeight">?attr/actionBarSize</item>
</style>

<style name="Widget.MarketBot.Toolbar.SmallCapsTitle">
Expand Down

0 comments on commit 10402a2

Please sign in to comment.