mikesol
02/07/2017, 2:13 PMViewPager
with FragmentPagerAdapter
, I'll take it!adeln
02/28/2017, 12:16 PMadeln
03/01/2017, 10:08 AMredrield
03/02/2017, 9:44 PMCannot load project: com.intellij.ide.plugins.PluginManager$StartupAbortedException: com.intellij.diagnostic.PluginException: org/jetbrains/android/uipreview/AndroidLayoutPreviewToolWindowManager [Plugin: org.jetbrains.kotlin.android.dsl]
I get this error when trying to load projects in Android Studio after getting the Anko preview pluginredrield
03/11/2017, 10:59 PMtmseiler
03/12/2017, 12:30 AMdavid.bilik
03/13/2017, 7:23 PMadambl4
03/17/2017, 12:44 PMra1nmak3r
03/17/2017, 9:37 PMeygraber
03/24/2017, 1:03 AMAnkoInternals.wrapContextIfNeeded
doesn't always work (e.g. I pass Widget.AppCompat.Button.Borderless
and instead of a flat button, I get a raised button with certain flat button attributes).
I've worked around it for now by declaring my own version of ViewManager.ankoView
, but it's annoying to either have a generic function (themedView
) or make a function for every View
that I would want it for:
inline fun <reified T : View> ViewManager.themedView(theme: Int, init: T.() -> Unit): T {
val ctx = AnkoInternals.wrapContextIfNeeded(AnkoInternals.getContext(this), theme)
val view = initiateView(ctx, T::class.java, theme)
view.init()
AnkoInternals.addView(this, view)
return view
}
fun <T : View> initiateView(ctx: Context, viewClass: Class<T>, theme: Int): T {
fun getConstructor() = viewClass.getConstructor(Context::class.java, AttributeSet::class.java, Int::class.java, Int::class.java)
fun getConstructor2() = viewClass.getConstructor(Context::class.java)
fun getConstructor3() = viewClass.getConstructor(Context::class.java, AttributeSet::class.java)
return try {
getConstructor().newInstance(ctx, null, 0, theme)
} catch (e: NoSuchMethodException) {
try {
getConstructor2().newInstance(ctx)
}
catch (e: NoSuchMethodException) {
try {
getConstructor3().newInstance(ctx, null)
}
catch (e: NoSuchMethodException) {
throw AnkoException("Can't initiate View of class ${viewClass.name}: can't find proper constructor")
}
}
}
}
blakelee
03/26/2017, 6:21 AMredrield
03/28/2017, 12:02 AMMark McCormick
04/05/2017, 5:40 PMghosalmartin
04/07/2017, 10:04 AMmiha-x64
04/11/2017, 1:04 PM+
0.10.0-beta-2
joe_androidsecurity
04/16/2017, 3:19 PManthonyeef
04/19/2017, 2:12 AMimageView
with svg resource but svg is not showing. Anyone met the same issue?blakelee
04/19/2017, 9:46 PManthaugh
04/24/2017, 7:57 AMcoordinatorLayout {
drawerLayout {
relativeLayout {
MY MAIN CONTENT
}
navigationView {
inflateHeaderView(R.layout.header) <- UGLY HACK, I CANNOT GET IT TO WORK ANY OTHER WAY
}
}
appBarLayout(R.style.AppTheme_AppBarOverlay) {
toolbar()
}
}
but still it shows under the action bar (it's overlapped by it)blakelee
04/24/2017, 11:42 PMeditText { addTextChangedListener (object : TextWatcher) {...}}
There is no member onTextChangedmikesol
05/05/2017, 10:40 PMmikesol
05/11/2017, 1:09 PMdeviant
05/12/2017, 7:34 PMinclude
AnkoComponent into another AnkoComponent? like we do it with xml layoutblakelee
05/15/2017, 7:40 AMdeviant
05/16/2017, 7:11 PMthan_
05/19/2017, 1:18 PMaakaashjois
05/22/2017, 11:03 AMframeLayout
inside the onCreate method. I tried to create var enableCheckBox: CheckBox
before declaring the frameLayout. But when i tried to access enableCheckBox
in the rest of the onCreate method, it gave an error saying Variable "enableCheckBox" must be initialized
miha-x64
05/22/2017, 11:08 AMvar enableCheckBox: CheckBox? = null
... {
enableCheckBox = checkBox { ... }
}
enableCheckBox!!....
anthaugh
05/30/2017, 4:02 PMapplyRecursively { v: View ->
when (v) {
is EditText -> v.lparams(matchParent, wrapContent) { bottomMargin = dip(8) }
}
}
but the margin isn't set. How should I code this?antonioleiva
05/31/2017, 7:44 AMlaunch(UI)
and async(UI)
tbh, but worth trying