- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我最近将我的 android 项目“升级”到了 SDK 版本 26,现在我的应用栏中的图标看起来像 this (在 Android 6.0 上运行),尽管图标本身看起来像 this .我不知道为什么会发生这种情况,我没有更改 java 或 xml 代码中似乎与此相关的任何内容。
如果有人发布了解决方案,我会很高兴,因为一旦 Android 8 发布,这可能是一个更大的问题。
构建.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "de.jamesbeans.quadrasolve"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "digit1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:percent:26.0.1'
}
<android.support.v7.widget.Toolbar
android:id="@+id/maintoolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimaryDark"
android:theme="@style/Widget.AppCompat.ActionBar"
android:visibility="visible"
app:popupTheme="@style/Theme.AppCompat.Light"
app:title="QuadraSolve"
app:titleTextColor="@android:color/background_light" />
Toolbar maintoolbar = (Toolbar) findViewById(R.id.maintoolbar);
setSupportActionBar(maintoolbar);
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.mainmenu, menu);
return true;
}
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_history"
android:icon="@mipmap/ic_history_48px"
android:title="@string/history"
app:showAsAction="ifRoom">
</item>
</menu>
最佳答案
遇到了同样的问题,偶然发现了这个似乎解决了问题的答案:
https://stackoverflow.com/a/45344964/4579919
The matter is that the icon size is bigger then the expected. Obviously the scaling mechanism has changed in SDK 26 and now it leads to this UI bug. Make sure the toolbar icon resources are provided in the following sizes.
关于android-studio - 图标在操作栏中看起来很平坦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45611508/
我在让我的操作栏显示图标时遇到问题。它显示了我在溢出菜单中设置的文本/标题(三个点),但没有任何操作。这是我的代码,我错过了什么? MainActivity.java public class Mai
我正在尝试在 android 中制作一个动态操作栏,现在我正在尝试像这样在操作栏中进行搜索。 http://developer.android.com/images/ui/actionbar-sear
我正在编写 uiautomator 测试,但我很难弄清楚如何单击我的操作栏图标。 如果我的操作是“始终”显示,则很容易找到并点击。 如果我的操作是显示“从不”,我必须单击菜单,然后从菜单中单击。先点击
我有一个正在寻找特定 URI 的重写规则。当它匹配特定的 URL 时,它会使用正确的文件路径重写它,以便可以找到所需的内容。然后它将协议(protocol)更改为 HTTPS 并允许请求通过。 我有两
我正在为 android 中的 ActionBar 而苦苦挣扎。 这是我的问题:我的操作项没有显示在操作栏中,而是堆叠在操作溢出中,无论我做什么.. 我花了一天的时间寻找解决方案,但我似乎找不到缺少的
我的网络应用程序在 Tomcat 下运行,它非常密集地使用 AJAX 请求,在开发过程中我也必须密集地重新部署网络应用程序。重新部署后,我通常会简单地刷新页面,知道用户 session 已删除,但我总
我是一名优秀的程序员,十分优秀!