本文整理汇总了Scala中android.widget.LinearLayout类的典型用法代码示例。如果您正苦于以下问题:Scala LinearLayout类的具体用法?Scala LinearLayout怎么用?Scala LinearLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LinearLayout类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: MainActivity
//设置package包名称以及导入依赖的类
package $package$.activity
import $package$.api.UiService
import $package$.model.Ticker
import android.content.{Intent, Context}
import android.view.View
import android.widget.{TextView, ProgressBar, LinearLayout}
import macroid.FullDsl._
import macroid._
import android.app.Activity
import android.os.Bundle
class MainActivity extends Activity with Contexts[Activity] with MainActivityView with UiService {
override def onCreate(b: Bundle): Unit = {
super.onCreate(b)
setTitle("Hello world, $name$!")
setContentView(ui.get)
update
}
def update = api(_.pubticker("btcusd")) mapUi updateView
def updateView(t: Ticker) = runUi(
lastPriceSlot <~ text("Whoa! Bitcoin price is " + t.last_price)
)
}
trait MainActivityView {
var lastPriceSlot = slot[TextView]
def ui(implicit context: ActivityContext): Ui[LinearLayout] = {
l[LinearLayout](
w[TextView] <~ wire(lastPriceSlot)
)
}
}
示例2: CheckableEntryViewHolder
//设置package包名称以及导入依赖的类
package sword.langbook.android.viewholders
import android.view.{LayoutInflater, ViewGroup}
import android.widget.LinearLayout
import sword.langbook.android.TR
import sword.langbook.android.TypedResource._
case class CheckableEntryViewHolder(linearLayout: LinearLayout) extends BaseViewHolder(linearLayout) {
val textView = linearLayout.findView(TR.conceptPickerEntryCaption)
val checkBox = linearLayout.findView(TR.conceptPickerSwitch)
}
object CheckableEntryViewHolder {
def newInstance(parent: ViewGroup) = {
val inflater = LayoutInflater.from(parent.getContext)
val view = inflater.inflate(TR.layout.checkable_entry, parent, false)
new CheckableEntryViewHolder(view)
}
}
示例3: CurrencyDetailsActivity
//设置package包名称以及导入依赖的类
package app.bitrader.activity
import android.os.Bundle
import android.widget.{LinearLayout, TextView}
import app.bitrader.activity.layouts.BasicLayout
import app.bitrader.api.poloniex.Currency
import macroid.ContextWrapper
import macroid.FullDsl._
class CurrencyDetailsActivity extends BaseActivity {
private val maybeCurrency = getParam[Currency]
private lazy val layout = new CurrencyDetailsLayout(maybeCurrency)
override def onCreate(b: Bundle): Unit = {
super.onCreate(b)
setContentView(layout.ui)
}
}
class CurrencyDetailsLayout(maybeCurrency: Option[Currency])(implicit cw: ContextWrapper) extends BasicLayout {
def ui = l[LinearLayout](
w[TextView] <~ (maybeCurrency map (c => text(c.name)))
).get
}
示例4: CurrencyListActivity
//设置package包名称以及导入依赖的类
package app.bitrader.activity
import android.os.Bundle
import android.widget.{LinearLayout, TextView}
import app.bitrader.activity.fragments.PairsListFragment
import app.bitrader.helpers.{Id, Styles}
import com.orhanobut.logger.Logger
import macroid.FullDsl._
import macroid._
class CurrencyListActivity extends BaseActivity with Styles{
override def onCreate(b: Bundle): Unit = {
super.onCreate(b)
setTitle("CurrencyListActivity")
val ui: Ui[LinearLayout] = l[LinearLayout](
f[PairsListFragment].ui <~ vMatchParent
) <~ vMatchParent
setContentView(ui.get)
}
}
示例5: ReadQrActivity
//设置package包名称以及导入依赖的类
package app.bitrader.activity.menu
import android.app.Activity
import android.graphics.PointF
import android.os.Bundle
import android.widget.{Button, LinearLayout, TextView}
import app.bitrader.activity.MainStyles
import com.google.zxing.Result
import macroid.{Contexts, Ui}
import macroid.FullDsl._
import macroid._
import me.dm7.barcodescanner.zxing.ZXingScannerView
class ReadQrActivity extends Activity with Contexts[Activity] with ZXingScannerView.ResultHandler with MainStyles {
override def onCreate(savedInstanceState: Bundle): Unit = {
super.onCreate(savedInstanceState)
setContentView(ui)
}
var qrText = slot[TextView]
def ui = {
l[LinearLayout](
w[TextView] <~ wire(qrText) <~ vWrap,
w[Button] <~ text("read qr") <~ onClick(runQr) <~ vWrapContent
) <~ vMatchWidth
}.get
lazy val scannerView: ZXingScannerView = new ZXingScannerView(this)
def runQr: Unit = {
setContentView(scannerView)
scannerView.setResultHandler(this)
scannerView.startCamera()
}
override def onPause(): Unit = {
super.onPause()
scannerView.stopCamera()
}
override def handleResult(result: Result): Unit = {
setContentView(ui)
println(s"got qr! ${result.getText}")
Ui.run(qrText <~ text(result.getText))
scannerView.stopCamera()
}
}
示例6: MainActivity
//设置package包名称以及导入依赖的类
package com.github.aafa.activity
import android.app.Activity
import android.os.Bundle
import android.widget.{LinearLayout, TextView}
import com.github.aafa.model.User
import io.realm.RealmConfiguration.Builder
import io.realm._
import macroid.FullDsl._
import macroid._
class MainActivity extends Activity with Contexts[Activity] with MainActivityView {
def realmConfiguration: RealmConfiguration = new Builder(this)
.deleteRealmIfMigrationNeeded()
.build()
def realm: Realm = Realm.getInstance(realmConfiguration)
override def onCreate(b: Bundle): Unit = {
super.onCreate(b)
setTitle("Hello world, realm-test!")
setContentView(ui.get)
test()
}
def test(): Unit = {
val user: User = new User()
user.name = "Hello, Realm!"
user.id = 1
realm.beginTransaction()
realm.clear(classOf[User])
realm.copyToRealm(user)
realm.commitTransaction()
val realmUser: User = realm.where(classOf[User]).equalTo("id", new Integer(1)).findFirst()
updateText(realmUser.name)
println(realmUser.name)
}
}
trait MainActivityView {
this: MainActivity =>
var textSlot = slot[TextView]
def ui: Ui[LinearLayout] = {
l[LinearLayout](
w[TextView] <~ wire(textSlot)
)
}
def updateText(s: String) = runUi(textSlot <~ text(s))
}