android-imagebutton

need a round imagebutton which clips the image in a circle

◇◆丶佛笑我妖孽 提交于 2021-01-07 01:24:50
问题 I need a round image-button which clips the image in a circle, but this is what I get->(see the bus image)->bus image I have given the description of Imagebutton xml and shape xml. The image is not clipped in a round circle, but it appears that the circle is divided into 2 parts and image is added in the middle. My code is as below-> CODE: layout/activity.xml: <ImageButton android:id="@+id/imageButtonGenerateBulk" android:layout_width="wrap_content" android:layout_height="wrap_content"

How to adjust image for custom imagebutton?

一世执手 提交于 2020-01-07 02:47:17
问题 I created custom triangle button, from code which was given by wonderful user so, here : How to create layout with buttons like on this picture? ( BUTTON THAT HAVE ACTUALLY SHAPE OF TRIANGLE, NOT MASK ) And i came in level, for adjusting design. I tried to make 9-patch img, also with normal, but it looks for inner button like this: And then bump into finding way for adjusting that image into triangle custom button, and found this solution: Android - Image Button Scale But what i got is not

Implementing Ripple effect outside ImageButton

微笑、不失礼 提交于 2019-12-30 01:37:09
问题 I am trying to implement ripple effect for ImageButton.I have set ripple in background and drawable image in the src for it. android:background="@drawable/myripplexml" android:src="@drawable/myimagepath" Its giving nice ripple effect inside button Layout. But I want Ripple effect to extend outside the Button Layout also.Another way to do it is using : android:background="?android:attr/selectableItemBackgroundBorderless" But it uses default color and style. How can I customize it regarding

android java.langNullPointerException null object reference

不打扰是莪最后的温柔 提交于 2019-12-24 07:45:53
问题 I am trying to initialize all the navigation bar buttons and assign Black background color, when user clicks on one of the button, that one should change color and all other should remain Black. But i get the following error: Attempt to invoke virtual method 'android.view.View android.widget.LinearLayout.getChildAt(int)' on a null object reference public void bottomNavIcons(View view){ for(int i=0;i<Constants.bottom_nav_icon.length;i++) { LinearLayout linearLayout = (LinearLayout) view

Android Responsive Image Button Layout

China☆狼群 提交于 2019-12-23 05:27:55
问题 I'm trying to create the design shown below but with a responsive height on the image buttons for different screens. While I can get a responsive width by using android:layout_weight I can't manage to apply the same method to the button's height. What I'm trying to achieve is what's shown below but with the height of the screen evenly distributed amongst the buttons. i.e. 25% of the screen's height for each row of buttons. Any help would be greatly appreciated! <?xml version="1.0" encoding=

Usage of gif in ImageButton

孤街浪徒 提交于 2019-12-18 09:47:00
问题 How to toggle between an animated GIF image and a static one in ImageButton's src when someone clicks it? in onCreate() I have this aButton3 = (ImageButton) findViewById(R.id.imageButton3); SharedPreferences sharedPreferences = getSharedPreferences("NAME", Context.MODE_PRIVATE); Boolean e = sharedPreferences.getBoolean("clicked3", false); The following gets executed when someone clicks the ImageButton public void buttonClick2(View v) { SharedPreferences sharedPreferences =

How to fire different activities when buttons are clicked in android?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 08:02:08
问题 I am currently developing an android app. I have 4 layouts in my app(1 main layout and 3 sub layouts). In my main layout I am using three imagebuttons and if each button is clicked it starts an activity. i.e., when a button is clicked it transitions over to the next layout. I used the onClicklistener() method to handle the event when the button is clicked. The problem is that when the first button is clicked it changes to the next layout successfully but when the other two buttons are clicked

Rotate an ImageButton on orientation change

与世无争的帅哥 提交于 2019-12-13 00:21:08
问题 I have an image button that I want to rotate when the orientation of the device changes. How can I rotate the image with some animation or transition ? 回答1: try this code snippet. rotate.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:repeatCount="0" android:duration="2000" /> </set> rorate_anticlockwise.xml <?xml version="1.0"

Image inside ImageButton not scaling to fill button

青春壹個敷衍的年華 提交于 2019-12-12 04:35:07
问题 My layout includes this ImageButton as shown: But as you can see, the image is not taking the full size of the ImageButton. This is the layout file where the ImageButton is defined: <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" app:srcCompat="@mipmap/dashboard_profile" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginLeft="71dp" android:layout_marginStart="71dp"

Android: Problems with adjusting view size in an ImageButton

有些话、适合烂在心里 提交于 2019-12-12 04:25:32
问题 I'm trying something that should be simple, an imageButton and some text that says something about it. My problem is, the view of the imageButton is bigger than the image itself. I'm certain that the actual image is not like this (I've tried with several images and the result is the same). By searching online, the solution I've found is to insert the attribute "adjustViewBounds". That seemed reasonable but it didn't work. Here I leave my code and an image of how the result looks. <?xml