imagebutton

Rounded corners android image buttons

别等时光非礼了梦想. 提交于 2019-11-27 14:58:17
I am trying to round corners on an android ImageButton, the code looks like this; <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageButton" android:layout_marginTop="57dp" android:src="@drawable/friends" android:padding="1dp" android

How to remove ImageButton's standard background image?

女生的网名这么多〃 提交于 2019-11-27 10:04:47
问题 In ImageButton I want to remove the standard button background image. In http://developer.android.com it is said, that one must define his\her own background image or set the background color to be transparent. I tried to set a black background, but it didn't make any effect... 回答1: You can use android:background="@null" for your ImageButton. 回答2: ImageButton.setBackgroundResource(0) 回答3: The best choice is not set a transparent background to your ImageButton . Give to your user a feedback

Can I create an ASP.NET ImageButton that doesn't postback?

て烟熏妆下的殇ゞ 提交于 2019-11-27 07:44:55
问题 I'm trying to use the ImageButton control for client-side script execution only. I can specify the client-side script to execute using the OnClientClick property, but how do I stop it from trying to post every time the user clicks it? There is no reason to post when this button is clicked. I've set CausesValidation to False, but this doesn't stop it from posting. 回答1: Here's one way you could do it without conflicting with the postback functioning of other controls: Define your button

Creating Imagebutton programmatically

陌路散爱 提交于 2019-11-27 06:10:46
问题 I want to create several ImageButtons programmatically. I am able to create them but the click event listener keeps receiving the same view (Button 2), whether I click on button 0 ,button1 or button 2. RelativeLayout gameBoard = (RelativeLayout) findViewById(R.id.RelGameboard); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT,1); for(int i = 0 ; i < 3

Difference between a clickable ImageView and ImageButton

喜夏-厌秋 提交于 2019-11-27 03:04:34
I'm just wondering if there is any significant difference between an ImageView that's set to be clickable, compared with an ImageButton ? Is there any reason for using one over the other? Is there any restriction on the drawable for an ImageButton that leaves ImageView as the only possible option? Will I possibly lose any functionality of a button if I opt for a clickable ImageView over ImageButton ? There's no differences, except default style. ImageButton has a non-null background by default. EDIT : Also, ImageButton.onSetAlpha() method always returns false, scaleType is set to center and it

Android Imagebutton change Image OnClick

半腔热情 提交于 2019-11-27 02:31:22
问题 I just added a new drawable folder under res folder. In the drawable folder, i copied the ic_launcher.png file from drawable-hdpi folder. I wanna change the standard ImageButton image through the new one when i press the button. I wrote some code, but when i start the app, it crashes. Button imgButton; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.imgButton).setOnClickListener(imgButtonHandler);

ImageButton in Android

吃可爱长大的小学妹 提交于 2019-11-27 01:48:17
问题 Can anybody tell me how to resize the imageButton to fit the image exactly? This is the code that I tried, but the image is placed at the position that I am locating using android:scaleType , but I am not able to reduce the size of imageButton . Please help me out in rectifying this issue. The code that I tried is: <ImageButton> android:id="@+id/Button01" android:scaleType="fitXY" // i have tried all the values for this attr android:layout_width="wrap_content" android:layout_height="wrap

Android: vertical 3d listview

泪湿孤枕 提交于 2019-11-27 01:43:19
问题 I would like to make vertical 3d list view like here, but for ImageButtons and for free. Is there any library or sample code for that? I am new in Android development, so I don't know how to animate such thing 回答1: its actually pretty simple. You need to extend ListView and override onDrawChild(). In there you can apply 3d transformation matrices to get the effect you want. I have a working example on my github Or you can have a look at this question which is quite similar. For your

Android custom ListView with ImageButton is not getting focus

不羁的心 提交于 2019-11-27 01:36:50
问题 I am developing an app for android TV. I have a listview with an ImageButton + Textview s as children. As TV does not take touch events but uses D-PAD or trackball remote I have to get focus on all clickable items so that user knows where the focus is. But the problem is I can get focus on list row if I add android:descendantFocusability="blocksDescendants" in the custom list row layout but ImageButton in the list row will not get focus. And if I remove above code then ImageButton gets focus

How do I keep the aspect ratio on image buttons in android?

穿精又带淫゛_ 提交于 2019-11-27 00:56:51
I have 5 square ImageButtons that I want to have lined up side by side on the bottom of the screen. I have each one set (different id's) as: <ImageButton android:id="@+id/box1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:adjustViewBounds="true" android:scaleType="fitXY" android:layout_weight="1" android:layout_margin="1dp" /> and I have the background assigned in main java like this: int[] imageIds = new int[] {R.id.box1,R.id.box2,R.id.box3,R.id.box4,R.id.box5}; for(int i = 0; i<5; i++){ imageButtons[i] = (ImageButton)