我在用户本地服务器上相当新.我正在使用http-server,它是Node的一个软件包.我正在使用它来使用Phaser库托管HTML5游戏.我有在游戏中使用的图像资源,有时我会更新这些资产.当我这样做时,对图像的更改不会反映在游戏中.我已经尝试重新启动服务器,但这没有帮助.他们通常需要一些时间来更新,大约一个小时.有什么想法会出错吗?
我正在尝试在 Android 中创建一个项目符号列表,其中项目符号与 TextView 中第一行的垂直中心对齐,如下所示:
单个项目符号/文本行的 XML 是这样的:
<android.support.constraint.ConstraintLayout
android:id="@+id/setup_intro_bullet_first_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/setup_intro_bullet_first"
style="@style/TextAppearance.AppCompat.Headline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/bullet"
android:textColor="@color/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/setup_intro_bullet_first_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:paddingTop="14dp"
android:text="@string/setup_intro_benefit_notification"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/setup_intro_bullet_first"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
在这里,我在 TextView 上使用填充来与项目符号对齐,但这不是解决方案,因为其他分辨率的对齐方式不一致。我还尝试将项目符号字符放在文本字符串本身中,但第二行文本将位于项目符号下方,这不是我想要的。我想要一些关于如何实现这一点的建议。
我最近开始搞乱AppCompat 21的新组件并实现Material Design.目前,我有一个带有工具栏的ActionBarActivity,并且我试图让它托管一个包含TextView项目的RecyclerView的片段(仅用于测试Recycler).我正在显示项目,但每个视图中的文本都被截断,整个Recycler覆盖工具栏,如下所示:

如您所见,有三个TextView.他们的文字被中途切断,它覆盖了工具栏(我知道没有标题).TextView项目布局包含在RecyclerView布局中,这是Fragment的布局.父Activity有一个FrameLayout - > Toolbar,FrameLayout.我将Fragment插入Activity的子FrameLayout.这是XML:
Recycler中的每个视图:
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textview"
android:layout_width="match_parent"
android:layout_height="48dp"
android:fontFamily="sans-serif"
android:paddingTop="16dp"
android:paddingBottom="20dp"
android:textSize="16sp"/>
Run Code Online (Sandbox Code Playgroud)
Recycler布局,即片段的布局:
<android.support.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/recycler_tasks"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="stuff.MainActivity$TaskFragment">
</android.support.v7.widget.RecyclerView>
Run Code Online (Sandbox Code Playgroud)
和父Activity的布局:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
我知道它必须是简单的东西,但我已经被困了一段时间,尝试各种各样的事情无济于事.
我在ConstraintLayout中有三个TextView,带有边距以使它们全部位于屏幕的中心.由于某种原因,TextViews中的文本被提前包装,即使第一行仍有空间.这里是什么样的布局应该看起来像预览:
以下是它在运行时的实际外观:
您可以在TextViews右侧看到文本可以放在第一行的额外空间.请记住,设备和预览都适用于Nexus 5X.
以下是此布局的XML:
<android.support.constraint.ConstraintLayout
android:id="@+id/bullet_holder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="45dp"
android:layout_marginLeft="45dp"
android:layout_marginRight="45dp"
android:layout_marginStart="45dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/setup_intro_subheader"
app:layout_constraintVertical_bias="0.23000002">
<ImageView
android:id="@+id/setup_intro_bullet_first"
style="@style/TextAppearance.AppCompat.Headline"
android:layout_width="4dp"
android:layout_height="4dp"
android:baseline="7dp"
android:src="@drawable/circle"
app:layout_constraintBaseline_toBaselineOf="@+id/setup_intro_bullet_first_text"
app:layout_constraintLeft_toLeftOf="parent" />
<TextView
android:id="@+id/setup_intro_bullet_first_text"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginStart="6dp"
android:text="@string/setup_intro_benefit_notification"
android:textColor="@android:color/white"
app:layout_constraintLeft_toRightOf="@+id/setup_intro_bullet_first"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/setup_intro_bullet_second"
style="@style/TextAppearance.AppCompat.Headline"
android:layout_width="4dp"
android:layout_height="4dp"
android:baseline="7dp"
android:src="@drawable/circle"
app:layout_constraintBaseline_toBaselineOf="@+id/setup_intro_bullet_second_text"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/setup_intro_bullet_second_text" />
<TextView
android:id="@+id/setup_intro_bullet_second_text"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginStart="6dp"
android:layout_marginTop="20dp"
android:text="@string/setup_intro_benefit_backlog"
android:textColor="@android:color/white"
app:layout_constraintLeft_toRightOf="@+id/setup_intro_bullet_second"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/setup_intro_bullet_first_text" />
<ImageView
android:id="@+id/setup_intro_bullet_third"
style="@style/TextAppearance.AppCompat.Headline"
android:layout_width="4dp"
android:layout_height="4dp"
android:baseline="7dp"
android:src="@drawable/circle"
app:layout_constraintBaseline_toBaselineOf="@+id/setup_intro_bullet_third_text"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/setup_intro_bullet_third_text" />
<TextView …Run Code Online (Sandbox Code Playgroud) 我正在将Google登录纳入我的应用程序,但在尝试构建项目时,我在Android Studio中遇到错误.我'com.google.android.gms:play-services-auth:9.0.2'在我的应用程序级gradle文件中包含作为依赖项,并'com.google.gms:google-services:2.0.0-alpha6'作为项目级gradle文件中的依赖项.构建项目给出了错误:Error:Failed to resolve: com.google.android.gms:play-services-measurement:9.0.2选择"安装存储库和同步项目",但单击此选项不会执行任何操作.我apply plugin: 'com.google.gms.google-services'在应用级gradle文件的末尾.没有其他我使用com.google.android.gms:play-services-*依赖项的实例.我通过SDK Manager安装了"Google Play服务".任何帮助将不胜感激,我可以根据需要提供更多信息.
android google-play-services android-studio android-gradle-plugin