我需要一个解决方案自动调节的width和height一个iframe勉强适合其内容.关键是iframe加载后可以更改宽度和高度.我想我需要一个事件动作来处理iframe中包含的主体尺寸的变化.
我需要能够在我的应用程序中选择日期和时间它应该通过使用对话框或启动新的意图来完成.
我现在的方式是,我已经开始了新的意图,因为我需要设置日期和时间.
我的问题是我需要在onCreate 上设置当前日期Datepicker(这可以Timepicker使用setCurrentHour和setCurrentMinute),并将其设置为下边界.
我在Android API中找不到任何用于执行此操作的函数DatePicker.
有人有建议解决这个问题吗?
提前致谢!
编辑:重要:DatePicker和,TimePicker必须在相同的对话框/意图中
我有一个登录部分,我使用TextInputLayout作为电子邮件和密码.两者都是一样的.我还使用数据绑定来显示错误消息.
如果它应显示错误提示,则错误发生在API <20上.
@Override
public void showEmailError() {
inputLayoutEmail.setError(sInvalidEmail);
}
Run Code Online (Sandbox Code Playgroud)
xml布局:
<android.support.design.widget.TextInputLayout
android:id="@+id/til_email"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginLeft="@dimen/default_margin_16dp"
android:layout_marginRight="@dimen/default_margin_16dp"
android:layout_marginTop="16dp"
android:layout_below="@id/login_img_logo"
android:layout_centerHorizontal="true"
android:textColorHint="@color/gray"
android:background="@drawable/login_edittext"
android:errorEnabled="@{viewmodel.obEmailErrorVisibility}"
>
<EditText
android:id="@+id/et_login"
android:layout_height="@dimen/login_view_height"
android:layout_width="@dimen/login_view_width"
android:inputType="text"
android:maxLength="50"
android:hint="@string/activity_login_hint_email"
android:text="@={viewmodel.email}"
android:textColor="@color/black"
android:textColorHint="@color/gray"
android:paddingLeft="@dimen/default_margin_16dp"
android:enabled="@{viewmodel.obIsEmailFieldEnabled}"
/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/til_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/default_margin_16dp"
android:layout_marginRight="@dimen/default_margin_16dp"
android:layout_marginTop="@dimen/default_margin_8dp"
android:layout_below="@id/til_email"
android:layout_centerHorizontal="true"
android:textColorHint="@color/gray"
android:background="@drawable/login_edittext"
android:errorEnabled="@{viewmodel.obPassErrorVisibility}"
>
<EditText
android:id="@+id/et_password"
android:layout_width="@dimen/login_view_width"
android:layout_height="@dimen/login_view_height"
android:hint="@string/activity_login_hint_password"
android:maxLength="50"
android:inputType="textPassword"
android:text="@={viewmodel.password}"
android:textColor="@color/black"
android:textColorHint="@color/gray"
android:paddingLeft="@dimen/default_margin_16dp"
android:enabled="@{viewmodel.obIsPassFieldEnabled}"
/>
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
作为背景我使用 login_edittext.xml
<solid android:color="@color/white" />
<corners
android:radius="@dimen/login_edittext_radius"
/>
Run Code Online (Sandbox Code Playgroud)
我检查了类似的答案,但大多数都与样式有关
我有一个javascript函数.
如何检查:
如果<head></head>调用了函数(在具有此函数的部分中),则不调用该函数
如果未调用函数(在<head></head>部分中没有此函数),则调用该函数
喜欢require_once或include_once与PHP
这是我写的第一款游戏,我试图在该Designed For Families部分将其发布到Google Play商店.应用程序通过以下反馈不断被拒绝:
Designed for Families中的应用必须包含准确反映应用体验的元数据文本和图像.
我已经阅读了所有的指导方针和政策,但我无法解决我的错误!我修改了简短和完整的描述,我觉得他们完全反映了应用程序.图像都是来自游戏的屏幕截图,因此它们应该准确地反映体验.
我已将"家庭类别"更改为"脑游戏",因为这是最适合该应用程序.我很高兴能够包含完整的描述和简短描述以及我用于发布的图像,但我不想用大量信息轰炸线程......
我完全错过了解反馈??? 它实际上是指androidManifest中的元数据吗?
我知道有许多关于从游戏商店被拒绝的帖子,但没有一个解决这个特殊问题.
感谢阅读我希望有人可以帮忙,因为我真的被卡住了!
我已经开始学习Kotlin并且不知道该语言的所有功能.
该函数用于显示FrameLayout中的片段.逻辑是第一次它应该始终add()是片段,下一次它将replace().此外,在某些情况下,我需要使用addToBackStack() 并在相同的情况下禁用左侧菜单.
fun showFragment(fragment : Fragment,
isReplace: Boolean = true,
backStackTag: String? = null,
isEnabled: Boolean = true)
{
/* Defining fragment transaction */
val fragmentTransaction = supportFragmentManager
.beginTransaction()
/* Select if to replace or add a fragment */
if(isReplace)
fragmentTransaction.replace(R.id.frameLayoutContent, fragment, backStackTag)
else
fragmentTransaction.add(R.id.frameLayoutContent, fragment)
/* Select if to add to back stack */
if(backStackTag != null)
fragmentTransaction.addToBackStack(fragment.javaClass.name)
fragmentTransaction.commit()
enableDrawer(isEnabled)
}
Run Code Online (Sandbox Code Playgroud)
问题:与Kotlin语言规范相关的功能代码是否有一些可能的改进,以使代码更清晰,因为现在该功能看起来像一个质量.
我遇到的错误如下:
引起:java.lang.IllegalArgumentException:没有为Class绑定的进程工厂.注射器工厂被绑定为MyActivity_的超类型:[MyActivity].你的意思是绑定注射器工厂的子类型?
据我所知,这是因为我正在使用AndroidAnnotations库.
AppComponent.class:
@Singleton
@Component(modules = {
AndroidInjectionModule.class,
AppModule.class,
ActivityBindingModule.class })
public interface AppComponent extends AndroidInjector<DaggerApplication> {
@Component.Builder
interface Builder {
@BindsInstance Builder application(Application application);
AppComponent build();
}
void inject(Application application);
@Override
void inject(DaggerApplication instance);
}
Run Code Online (Sandbox Code Playgroud)
AppModule.class:
@Module
public abstract class AppModule {
@Binds
abstract Context provideContext(Application application);
@Provides
@Singleton
static SharedPreferencesManager providesPreferences(Application application){
return SharedPreferencesManager_.getInstance_(application);
}
}
Run Code Online (Sandbox Code Playgroud)
ActivityBindingModule.class:
@Module
public abstract class ActivityBindingModule {
@ContributesAndroidInjector(modules = LoginActivityModule.class)
@LoginActivityScope
abstract LoginActivity bindLoginActivity();
}
Run Code Online (Sandbox Code Playgroud)
Application.class:
@EApplication …Run Code Online (Sandbox Code Playgroud) 为什么IGNORE语句不起作用?每次我运行这个相同的值都插入数据库,我不知道为什么?
myDB = this.openOrCreateDatabase(MY_DB_NAME, MODE_PRIVATE, null);
myDB.execSQL("INSERT OR IGNORE INTO " + MY_DB_TABLE + "(db_datum, db_zahlen, db_scheine)"
+"VALUES ('"+datum+"',"+
"'"+zahlen+"',"+
"'"+9+"');");
Run Code Online (Sandbox Code Playgroud)
db模式是:
db_datum(varchar(100))
db_zahlen(varchar(100))
db_scheine(整数)
我有2个字符串"datum"和"zahlen",并希望将它们插入数据库中.现在问题是,如果db中已经存在相同的字符串并且代码再次运行,则它们将被忽略并且永远不会再次插入.
最近,我发现了有关Room db的文章,并且有第一个技巧将数据预填充到数据库中。
创建数据库时,当前是否存在某种优雅的方法来预填充数据?
我正在使用Dagger2,因此实际创建数据库非常容易。
@Module
class DatabaseModule{
@Provides
@Singleton
fun provideObjectBox(context: Context): BoxStore =
MyObjectBox.builder()
.androidContext(context)
.build()
}
Run Code Online (Sandbox Code Playgroud)
现在,我使用SharedPreferences的方式。因此,我只是检查它是否是数据库的第一个设置,而不是填充数据库。
在对使用 ObjectBox 数据库的类进行单元测试时,我收到此错误:
io.objectbox.exception.DbDetachedException:无法解析分离实体的关系
我已将所有必要的数据实现到我的实体类中,以便在 macOS 上进行单元测试。因此,具有指向自身的一对一和一对多关系的实体关系。
@Entity
data class Category(
@Id var id: Long? = 0,
var title: String?,
@JvmField var parent: ToOne<Category>? = null,
@JvmField @Backlink(to = "parent") var subCategories: ToMany<Category>? = null){
constructor(): this(id = 0, title = "", parent = null, subCategories = null)
constructor(title: String): this(id = 0, title = title, parent = null, subCategories = null)
// normally transformer would add field, but need to manually for local unit tests
@JvmField @Transient var __boxStore: …Run Code Online (Sandbox Code Playgroud) android ×7
javascript ×2
objectbox ×2
adjustment ×1
aop ×1
dagger ×1
dagger-2 ×1
datepicker ×1
google-play ×1
html ×1
iframe ×1
java ×1
kotlin ×1
sqlite ×1
xml ×1