• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Scala LinearLayout类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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)
    )
  }

} 
开发者ID:aafa,项目名称:rest-android-scala.g8,代码行数:40,代码来源:MainActivity.scala


示例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)
  }
} 
开发者ID:carlos-sancho-ramirez,项目名称:android-scala-langbook,代码行数:20,代码来源:CheckableEntryViewHolder.scala


示例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
} 
开发者ID:aafa,项目名称:bitrader,代码行数:26,代码来源:CurrencyDetailsActivity.scala


示例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)
  }
} 
开发者ID:aafa,项目名称:bitrader,代码行数:26,代码来源:CurrencyListActivity.scala


示例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()
  }


} 
开发者ID:aafa,项目名称:bitrader,代码行数:54,代码来源:ReadQrActivity.scala


示例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))
} 
开发者ID:aafa,项目名称:realm-sbt-plugin,代码行数:60,代码来源:MainActivity.scala



注:本文中的android.widget.LinearLayout类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Scala Subscriber类代码示例发布时间:2022-05-23
下一篇:
Scala RouterCtl类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap