imagebutton

android ImageButton显示本地图片

荒凉一梦 提交于 2021-02-09 04:52:39
得到本地图片(png,jpeg,gif)的路径后,将图片显示在ImageButton上。这里先读出图片大小,在设置采样率,使得大图片也能一览全貌。 参考: android Bitmap学习总结 void foo(){ String filepath = bundle.getString("path"); Options opts = new Options(); opts.inJustDecodeBounds = true; BitmapFactory.decodeFile(filepath, opts); int samp = LtUtil.getPictureSampleSize( opts.outWidth, opts.outHeight); opts.inJustDecodeBounds = false; opts.inSampleSize = samp; Bitmap bm = BitmapFactory .decodeFile(filepath, opts); if (bm != null) { pictureButton.setImageBitmap(bm); } } 来源: oschina 链接: https://my.oschina.net/u/937845/blog/129945

svg image as button in flutter

霸气de小男生 提交于 2021-02-08 13:54:15
问题 I created a play-button and saved it as a svg dokument. I have also created my home screen with a picture in the background and a floatingActionButton centered. (I used stack for this). import 'package:flutter/material.dart'; class MyBackgroundWidget extends StatelessWidget { @override Widget build(BuildContext context) { return new Stack( children: <Widget>[ new Container( child: new Image.asset('assets/Backgr.png'), width: double.infinity, height: double.infinity), Center( child: new

Kivy - How do I restrict the ImageButton click space to only on the image itself? (and not the blank “occupied” space)?

戏子无情 提交于 2021-01-29 05:19:14
问题 I have four ImageButtons in a row, all separated by (what seems to be) blank space. This blank space also however acts as a button (up to the halfway point between the two Buttons' entire section allocated for the Image) ''' FloatLayout: canvas: Color: rgb: utils.get_color_from_hex("#0a5a97") Rectangle: size: self.size pos: self.pos pos_hint: {"top":0.125,"right":1} size_hint: 1,.125 ImageButton: source: "Icons5/040-user.png" pos_hint: {"top":0.95,"right":1} size_hint: .3,.7 on_release: print

How to add image for button in android?

会有一股神秘感。 提交于 2020-07-31 07:46:09
问题 How can I add an image to a button, rather than text? 回答1: Rather humorously, considering your tags, just use the ImageButton widget. 回答2: Simply use ImageButton View and set image for it:` <ImageButton android:id="@+id/searchImageButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:src="@android:drawable/ic_menu_search" /> 回答3: As he stated, used the ImageButton widget. Copy your

How to add image for button in android?

喜欢而已 提交于 2020-07-31 07:46:06
问题 How can I add an image to a button, rather than text? 回答1: Rather humorously, considering your tags, just use the ImageButton widget. 回答2: Simply use ImageButton View and set image for it:` <ImageButton android:id="@+id/searchImageButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:src="@android:drawable/ic_menu_search" /> 回答3: As he stated, used the ImageButton widget. Copy your

How can I make make a border for a clicked imagebutton in Android?

旧城冷巷雨未停 提交于 2020-06-25 18:09:24
问题 I am using Imagebuttons to show some icons in my android project. <ImageButton android:id="@+id/button_one" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:padding="20dp" android:contentDescription="@string/button_one" android:background="@android:color/transparent" android:src="@drawable/button_one" /> I would like, when the button is in pressed state, there to be a white border with

How to pass multiple values through command argument in Asp.net?

送分小仙女□ 提交于 2020-05-09 20:13:42
问题 I have ImageButton with CommandArgument attribute which is having multiple Eval value. When I click one of them I want to pass values to ImageButton2_Click event but it does not work because Command arguments is null. <div class="sag-re-icerik" id="icerik2" runat="server">Lorem ipsum dolor sit amet, consectetur commodo et convallis et, auctor viverra metus. Aenean pharetra, arcu nec viverra mollis, turpis neque feugiat massa, non dapibus neque nunc ac orci. </div> <div class="oy-verme"> <div

How to pass multiple values through command argument in Asp.net?

左心房为你撑大大i 提交于 2020-05-09 20:07:50
问题 I have ImageButton with CommandArgument attribute which is having multiple Eval value. When I click one of them I want to pass values to ImageButton2_Click event but it does not work because Command arguments is null. <div class="sag-re-icerik" id="icerik2" runat="server">Lorem ipsum dolor sit amet, consectetur commodo et convallis et, auctor viverra metus. Aenean pharetra, arcu nec viverra mollis, turpis neque feugiat massa, non dapibus neque nunc ac orci. </div> <div class="oy-verme"> <div

How to pass multiple values through command argument in Asp.net?

丶灬走出姿态 提交于 2020-05-09 20:05:52
问题 I have ImageButton with CommandArgument attribute which is having multiple Eval value. When I click one of them I want to pass values to ImageButton2_Click event but it does not work because Command arguments is null. <div class="sag-re-icerik" id="icerik2" runat="server">Lorem ipsum dolor sit amet, consectetur commodo et convallis et, auctor viverra metus. Aenean pharetra, arcu nec viverra mollis, turpis neque feugiat massa, non dapibus neque nunc ac orci. </div> <div class="oy-verme"> <div

How do I change the tint of an ImageButton on focus/press

[亡魂溺海] 提交于 2020-01-19 03:10:29
问题 I have an ImageButton in my app and I need to change the tint of the image when the button is pressed/focused . I have the ImageButton set to get its src from an XML file which as follows: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- pressed --> <item android:state_pressed="true" android:tint="@color/black" android:drawable="@drawable/search" /> <!-- focused --> <item android:state_focused="true" android:tint="@color/black"