【问题标题】:Android place picker style actionbarAndroid 地点选择器样式操作栏
【发布时间】:2016-02-27 00:19:31
【问题描述】:

我试图在我的应用程序中使用Place Picker 库,但似乎我在“位置选择器”屏幕的样式方面遇到了问题。有人能告诉我如何设置这个屏幕的样式吗?它是否可以设置样式?这是我在我的设备上得到的:

这是我使用的 AppTheme:

<!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. TODO -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorPrimaryDark</item>


        <!--style for switchCompat-->
        <item name="colorControlActivated">@color/white</item>
        <item name="colorSwitchThumbNormal">@color/white</item>
        <item name="android:colorForeground">@color/white</item>

        <!--<item name="actionBarStyle">@style/Widget.AppTheme.ActionBar</item>-->
        <item name="buttonStyle">@style/My.Button</item>
    </style>

编辑:这只发生在我的带有 android 4.4 的 Note 2 设备上,有人知道解决这个问题的方法吗?

【问题讨论】:

    标签: android google-places-api android-location android-googleapiclient


    【解决方案1】:

    对于 5.0 以下的 android 版本,请使用 PlaceAutocomplete.MODE_OVERLAY

     private void launchLocationAutoComplete() {
            try {
                Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY).build(this);
                startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE);
            } catch (GooglePlayServicesRepairableException e) {
                Log.e(TAG, "GooglePlayServicesRepairableException", e);
            } catch (GooglePlayServicesNotAvailableException e) {
                Log.e(TAG, "GooglePlayServicesNotAvailableException", e);
            }
        }
    

    【讨论】:

      【解决方案2】:
          <android.support.v7.widget.Toolbar
              android:id="@+id/toolbar"
              android:layout_width="match_parent"
              android:minHeight="?attr/actionBarSize"
              android:layout_height="wrap_content"
              android:background="?attr/colorPrimary"
              app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
              app:popupTheme="@style/AppTheme.PopupOverlay" />
      

      使用这种风格和背景,因为您在活动中使用无操作栏。检查原色并使用深色而不是白色。您在工具栏中使用的样式代码可能是这样的代码:

          <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
      
          <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
      

      【讨论】:

      • PlacePicker 是一种重定向到旅游应用程序之外的意图。所以你不能手动处理风格。从请求应用程序(您的)自动应用
      猜你喜欢
      • 2014-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多