当用户点击瓷砖时,我正试图InkWell
在图像顶部使用涟漪效果GridTile
.
我相信图像本身会模糊纹波,因为当我移除图像时,我看到了波纹.
下面是单个GridTile的代码.
return new InkWell(
onTap: () => debugPrint(s.displayName),
highlightColor: Colors.pinkAccent,
splashColor: Colors.greenAccent,
child: new GridTile(
footer: new GridTileBar(
title: new Text(s.displayName),
subtitle: new Text(s.gameName),
backgroundColor: Colors.black45,
trailing: new Icon(
Icons.launch,
color: Colors.white,
),
),
child: new Image.network( //this is obscuring the InkWell ripple
s.imageSrc,
fit: BoxFit.cover,
),
),
);
Run Code Online (Sandbox Code Playgroud)
我已经尝试将InkWell移动到层次结构的不同级别,使用DecorationImage
内部a Container
,但这些似乎都无法揭示波纹.
如何让纹波出现在图块/图像的顶部?
我正在尝试使用此.travis.yml文件在我的Android项目上使用Travis CI构建
language: android
android:
components:
- platform-tools
- tools
- build-tools-23.0.3
- android-23
- sys-img-armeabi-v7a-android-23
- sys-img-x86-android-23
Run Code Online (Sandbox Code Playgroud)
这是我的app level build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.myname.myproject"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug{
testCoverageEnabled = true
}
}}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
testCompile "org.robolectric:robolectric:3.1.2"
testCompile 'org.khronos:opengl-api:gl1.1-android-2.1_r1'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19' …
Run Code Online (Sandbox Code Playgroud) 我想用折叠的collapsingToolbar加载一个片段(即以非扩展形式).当我设置collapsingToolbar的标题而不改变appbarLayout布局参数时,标题设置正确,我可以看到标题.
问题是,我还需要更改appBarLayout布局参数以防止collapsingToolbar扩展(即我希望它看起来和行为像这个特定片段的常规非折叠工具栏).但是,这样做会使标题不再出现.
我尝试了什么: 我尝试过在这些页面上列出的解决方案无济于事:
collapsingToolbarLayout.setTitleEnabled(true);
似乎没有任何影响MainActivity.java 我相信我已将问题隔离到这些行,但我不知道如何解决它.
collapsingToolbarLayout.setTitle("All Recent"); // works
appBarLayout.setExpanded(false, true); // works
// However, after adding the following lines, the above no longer works and the title does not appear in the toolbar
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams)appBarLayout.getLayoutParams();
lp.height = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 80, getResources().getDisplayMetrics());
appBarLayout.setLayoutParams(lp);
Run Code Online (Sandbox Code Playgroud)
activity_main.xml中
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/detail_backdrop_height"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop" …
Run Code Online (Sandbox Code Playgroud) android android-collapsingtoolbarlayout android-appbarlayout
Android 的导航组件能否用于在 BottomSheet 内导航(即在单个底部工作表中替换/添加片段)?
我知道如何BottomSheetDialogFragment
使用<dialog>
导航图中的标签启动一个。例如,下面的代码nav_graph.xml
允许用户从一个BottomSheetDialogFragment
(fragmentOne)导航到另一个BottomSheetDialogFragment
(fragmentTwo)。FragmentTwo 作为第二个BottomSheet 打开,位于FragmentOne 的BottomSheet 之上。
但是,如果我想让 fragmentTwo 替换同一个 BottomSheet 中的 fragmentOne 怎么办?我将如何使用导航图完成此操作?
<navigation android:id="@+id/nav_graph"
app:startDestination="@id/fragmentOne">
<dialog android:id="@+id/fragmentOne"
android:name="com.example.navcomponentapp.FragmentOne"
android:label="fragment_fragment_one"
tools:layout="@layout/fragment_fragment_one">
<action android:id="@+id/action_fragmentOne_to_fragmentTwo2"
app:destination="@id/fragmentTwo"/>
</dialog>
<dialog android:id="@+id/fragmentTwo"
android:name="com.example.navcomponentapp.FragmentTwo"
android:label="fragment_fragment_two"
tools:layout="@layout/fragment_fragment_two"/>
</navigation>
Run Code Online (Sandbox Code Playgroud)
演示(这不是我想要的。我不想在另一个bottomSheet上打开一个bottomSheet
android android-navigation android-architecture-components android-jetpack android-navigation-graph
我正在尝试在 Android 模拟器上使用 Google Play 商店进行测试。但是,在下载或更新应用程序时,我总是陷入“待处理”状态。
我在 Apple M1 上并从 Android Studio 启动模拟器。
我在尝试为Android Google登录注销时收到此错误消息:
Caused by: java.lang.IllegalStateException: GoogleApiClient is not connected yet.
Run Code Online (Sandbox Code Playgroud)
崩溃发生在DrawerActivity.java(下面)中,我在其中调用signOut()方法.
我已经查看了其他帖子中的解决方案,并试过它们无济于事:
java.lang.IllegalStateException:GoogleApiClient尚未连接
GoogleApiClient尚未连接异常 致命异常:java.lang.IllegalStateException GoogleApiClient尚未连接
MainActivity.java:
protected void onCreate(Bundle savedInstanceState) {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
//... other code for google sign in not shown
}
protected void onStart() {
mGoogleApiClient.connect();
}
private void handleSignInResult(GoogleSignInResult result) {
if (result.isSuccess()) {
App.getInstance().setClient(mGoogleApiClient);
//start DrawerActivity
}
}
Run Code Online (Sandbox Code Playgroud)
在DrawerActivity.java中(我要执行注销)
private void googleSignOut(){
mGoogleApiClient = App.getInstance().getClient();
Auth.GoogleSignInApi.signOut(mGoogleApiClient);
}
Run Code Online (Sandbox Code Playgroud)
在我的App活动中扩展了Application(用于存储GoogleApiClient)
public class App extends Application {
private GoogleApiClient mGoogleApiClient;
private …
Run Code Online (Sandbox Code Playgroud) java android google-api-client android-studio android-googleapiclient
我需要以编程方式在RecyclerView上设置上边距,但我得到以下异常:
java.lang.RuntimeException: Unable to resume activity java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.support.v7.widget.RecyclerView$LayoutParams
这是我的代码:
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams)recyclerView.getLayoutParams();
int marginTopDp = (int)getResources().getDimension(R.dimen.margin);
int marginTopPx = (int) (marginTopDp * getResources().getDisplayMetrics().density + 0.5f);
layoutParams.setMargins(0, marginTopPx, 0, 0);
recyclerView.setLayoutParams(layoutParams);
Run Code Online (Sandbox Code Playgroud)
如果我使用ViewGroup.LayoutParams layoutParams = recyclerView.getLayoutParams
堆栈跟踪建议,我不能再调用setMargin
因为该方法不存在ViewGroup.LayoutParams
.
任何帮助,将不胜感激.
我在一些流行的应用程序中在BottomSheets 上看到过这种灰色的把手装饰。这是 Google Maps 中 BottomSheet 的屏幕截图。注意BottomSheet 顶部的灰色手柄/夹具。
实现这样的装饰或背景的最佳方法是什么?这个装饰有标准材质或者安卓风格吗?
我正在尝试按照文档将我的 Android 应用程序与 Firebase 性能监控集成。
我看到控制台中报告了数据,但我总是看到“0 个会话”。当我点击“查看会话”时,我只收到一条通用消息,提示我需要升级 SDK。
我在用'com.google.firebase:firebase-perf:20.0.1'
。
我错过了什么吗?
当我更改微调器的背景颜色时,下拉箭头消失。我在这里看到了类似问题的一些答案,但它们并没有真正解决如何使箭头“重新出现”或直接从 XML 更改箭头的颜色(假设这是可能的)。
我试图将箭头设置为白色,但微调器(使用下面的代码)仍然显示没有箭头。
<Spinner
android:id="@+id/eventSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@android:color/holo_green_dark"
android:dropDownSelector="#ffffff"
android:popupBackground="@android:color/holo_green_dark"
android:spinnerMode="dropdown" />
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激。提前致谢。
android spinner background-color android-layout android-spinner
android ×9
android-architecture-components ×1
android-collapsingtoolbarlayout ×1
bottom-sheet ×1
firebase ×1
flutter ×1
google-play ×1
gradle ×1
java ×1
layoutparams ×1
spinner ×1
travis-ci ×1