gpt4 book ai didi

Android - Activity Home/向上箭头在 SDK 24 中有额外的填充/边距

转载 作者:IT王子 更新时间:2023-10-28 23:28:17 25 4
gpt4 key购买 nike

我刚刚将我的应用从使用 SDK 23 更新到 SDK 24。

我的 Activity 出现了一个问题,这些 Activity 显示了向上/主页箭头(即 getSupportActionBar().setDisplayHomeAsUpEnabled(true)),因为现在向上之间有额外的(不需要的)空间箭头和 Activity 标题。

对于没有向上箭头的 Activity , Activity 标题与之前的位置完全相同,这表明额外的填充/边距与向上箭头相关联,而不是与 Activity 标题相关联。

我的问题是如何更改布局,使其在 SDK 24 中看起来与在 SDK 23 中相同?

向上箭头和使用 SDK 23 的标题之间的小间隙: Small gap between Up arrow and title using SDK 23

使用 SDK 24 的向上箭头和标题之间存在较大(不需要的)间隙: Large (unwanted) gap between Up arrow and title using SDK 24

这是我的旧 build.gradle (SDK 23):

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 19
targetSdkVersion 23
versionCode 42
versionName "0.42"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-vision:9.0.2'
compile 'ch.acra:acra:4.7.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v13:23.4.0'
compile 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
compile 'com.google.zxing:core:3.2.1'
}

这是新的 build.gradle (SDK 24):

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 19
targetSdkVersion 24
versionCode 42
versionName "0.42"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-vision:9.0.2'
compile 'ch.acra:acra:4.7.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:support-v13:24.0.0'
compile 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
compile 'com.google.zxing:core:3.2.1'
}

最佳答案

这已在 Android 问题跟踪器中得到解答。链接是:

https://code.google.com/p/android/issues/detail?id=213826

app:contentInsetStartWithNavigation="0dp" 添加到工具栏 View 。

关于Android - Activity Home/向上箭头在 SDK 24 中有额外的填充/边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37859807/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com