这是我的对话框的 xml 文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/main"
android:paddingTop="23dp"
android:background="@android:color/white">
<ImageView
android:id="@+id/officer"
android:layout_width="47dp"
android:layout_height="47dp"
android:layout_marginLeft="24dp"
android:background="@drawable/officerman"/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Are you sure you want\nto sign out?"
android:textSize="15.5dp"
android:textColor="#1C86FF"
android:layout_marginTop="4dp"
android:lineSpacingExtra="2dp"
android:layout_marginLeft="84dp"/>
<LinearLayout
android:layout_marginTop="20dp"
android:layout_width="264dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:layout_below="@id/officer">
<Button
android:id="@+id/yes"
android:layout_width="wrap_content"
android:layout_weight="0.5"
android:layout_height="42dp"
android:background="#1C86FF"
android:text="Yes"
android:textAllCaps="false"
android:textSize="15dp"
android:textColor="@android:color/white"/>
<Button
android:id="@+id/no"
android:layout_width="wrap_content"
android:layout_weight="0.5"
android:layout_height="42dp"
android:background="#0078FF"
android:textSize="15dp"
android:textColor="@android:color/white"
android:textAllCaps="false"
android:text="No"/>
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的java代码
AlertDialog.Builder build = new AlertDialog.Builder(Login.this);
View lview = getLayoutInflater().inflate(R.layout.dialog_leave,null);
build.setView(lview);
AlertDialog dialog = build.create();
dialog.show(); …Run Code Online (Sandbox Code Playgroud) 在这里,我开发了一个Android应用程序,可以在所有屏幕尺寸和分辨率设备上运行.但有一个问题是我的TextView'sFontsize在所有屏幕尺寸上都是相同的.我想FontSize根据不同ScreenSize和屏幕分辨率进行更改.
提前致谢.
我使用ionic2带FCM.
我在应用运行时收到通知.
我需要在应用程序运行时收到通知.
我怎样才能做到这一点 ?
做指南ConstraintLayout支持RTL吗?我正在创建一个View右侧有个人资料图片和用户信息.我希望图片占用宽度的30%,而用户名和细节占70%.这是指南的有效用例吗?我知道其他实现,但我想知道是否可以在这里使用指南.我面临的问题是,在将设备语言更改为RTL语言后,指南仍保留在左侧的位置
这是xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:background="@color/colorPrimary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
tools:text="Full Name"
app:layout_constraintTop_toTopOf="@+id/imageView"
app:layout_constraintStart_toEndOf="@+id/guideline2" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
tools:text="Android Developer"
app:layout_constraintBottom_toBottomOf="@+id/imageView"
app:layout_constraintStart_toEndOf="@+id/guideline2" />
<android.support.constraint.Guideline
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/guideline2"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.30" />
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud) 首先,我开始Activity用FLAG_ACTIVITY_NEW_TASK,然后使用命令“亚行外壳dumpsys Activity”,最后我发现在一个任务中的两项活动?
Intent intent = new Intent(this, Main2Activity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
这些Activity是正常的,我没有修改它们?这些是堆栈信息。
ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities)
Display #0 (activities from top to bottom):
Stack #1:
mFullscreen=true
mBounds=null
Task id #2493
mFullscreen=true
mBounds=null
mMinWidth=-1
mMinHeight=-1
mLastNonFullscreenBounds=null
* TaskRecord{cb64df8 #2493 A=com.example.flag U=0 StackId=1 sz=2}
userId=0 effectiveUid=u0a63 mCallingUid=2000 mUserSetupComplete=true mCallingPackage=null
affinity=com.example.flag
intent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.flag/.MainActivity}
realActivity=com.example.flag/.MainActivity
autoRemoveRecents=false isPersistable=true numFullscreen=2 taskType=0 mTaskToReturnTo=1
rootWasReset=false mNeverRelinquishIdentity=true mReuseTask=false mLockTaskAuth=LOCK_TASK_AUTH_PINNABLE
Activities=[ActivityRecord{b786d24 u0 com.example.flag/.MainActivity t2493}, ActivityRecord{afe6f61 u0 com.example.flag/.Main2Activity t2493}]
askedCompatMode=false inRecents=true …Run Code Online (Sandbox Code Playgroud) 我是 React-Native 开发的新手。我正在使用' react-navigation '中的TabNavigator作为React-Native中的标签栏,除了标签栏activeBackgroundColor和inactiveBackgroundColor在android中没有改变外,一切正常。它只显示蓝色,如下图所示。
我使用的代码是:
import React, { Component } from 'react';
import { TabNavigator } from 'react-navigation';
import { PixelRatio } from 'react-native';
import { ColorScheme } from '../Resources/ColorScheme';
import {Fonts} from '../Resources/Fonts';
import TAB1 from '../Screens/TAB1'
import TAB2 from '../Screens/TAB2'
/** */
var FONT_SIZE = 8;
if (PixelRatio.get() === 2) {
FONT_SIZE=10
}else if (PixelRatio.get() === 3) {
FONT_SIZE=12
}
export default FavoritesScreenTabNavigator=TabNavigator({
TAB1:{screen:TAB1},
TAB2:{screen:TAB2}
},{
tabBarPosition:'top',
swipeEnabled:true,
animationEnabled:true,
tabBarOptions:{
activeTintColor:ColorScheme.tabBarSelectedTintColor,
inactiveTintColor:ColorScheme.tabBarUnSelectedTintColor,
activeBackgroundColor:'white', …Run Code Online (Sandbox Code Playgroud) 我想在我的RecyclerView Layout. 我已经搜索了一段时间,但我只能找到使用 的解决方案RecyclerView.addItemDecoration,它在所有项目之间添加了分隔线。我可以创建一个只有一行的布局并将其添加到RecyclerView,但这对我来说似乎不是一个优雅的解决方案。
我正在使用带有Realm,Gson注释的Kotlin数据类从服务器获取数据.
问题:当我在android studio中运行项目时,会出现以下错误
Error:Class "VenderConfig" contains illegal final field "name".
Run Code Online (Sandbox Code Playgroud)
我正在学习Kotlin,所以对此并不太了解.
我的VenderConfig班级是:
@RealmClass
class VenderConfig(
@SerializedName("name")
val name: String? = null,
@SerializedName("website")
val wb_url: String? = null,
@SerializedName("icon")
val icon: String? = null,
@SerializedName("logo")
val logo: String? = null,
@SerializedName("description")
val description: String? = null,
@PrimaryKey
@SerializedName("id")
val id: Int? = null
) : RealmObject() {
}
Run Code Online (Sandbox Code Playgroud)
我也尝试使用字段打开关键字并删除数据关键字,但它没有解决问题.
我只是有一个自定义Toolbar工作,然后试图在我的Android项目中获得Dagger2并且运行到我DaggerActivity没有延伸AppCompatActivity的教程我说过要使用.
即.我按照这些说明https://developer.android.com/training/appbar/setting-up.html
有没有办法同时使用它们?
谢谢,迪恩
是否可以使用滑行缓存图像而不在imageView?中显示它。如果是,那又如何?
现在,我正在执行以下代码:
Glide
.with(getApplicationContext())
.load("imageUrl")
.override(windowWidth(),(int)windowWidth()*0.5))
.diskCacheStrategy(DiskCacheStrategy.ALL);
Run Code Online (Sandbox Code Playgroud)
但这是行不通的,当应用打开时,滑行不是从缓存而是从URL加载图像。