Sha256: 9a6070fec4bd65a7e7f8f5f74d5319341c18248041283ed46ea0aa4e0587283b

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require 'ruboto/widget'

ruboto_import_widgets :Button, :ImageButton, :LinearLayout, :TextView

class ImageButtonAndButtonActivity
  def on_create(bundle)
    super
    setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')

    self.content_view =
        linear_layout :orientation => LinearLayout::VERTICAL, :gravity => android.view.Gravity::CENTER_HORIZONTAL do
          @text_view = text_view :text => 'What hath Matz wrought?', :id => 42, :text_size => 48.0,
                                 :width => :fill_parent, :gravity => android.view.Gravity::CENTER
          button :text => 'Button', :id => 44, :text_size => 48.0,
                 :width => :fill_parent, :gravity => android.view.Gravity::CENTER,
                 :on_click_listener => proc { @text_view.text = 'Button pressed' }
          image_button :image_resource => $package.R::drawable::get_ruboto_core, :id => 43, :width => :wrap_content,
                       :on_click_listener => proc { @text_view.text = 'Image button pressed' }
        end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruboto-0.10.2 test/activity/image_button_and_button_activity.rb
ruboto-0.10.2.rc.0 test/activity/image_button_and_button_activity.rb