android-button

How to properly remove padding (or margin?) around buttons in Android?

耗尽温柔 提交于 2019-12-29 03:14:27
问题 Currently, I have the following bottom log in button. When button is not being pressed When button is being pressed The XML looks like this <LinearLayout android:background="?attr/welcomeBottomNavBarBackground" android:orientation="horizontal" android:id="@+id/sign_in_bottom_nav_bar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true"> <Button style="?android:attr/buttonBarButtonStyle" android:id="@+id/sign_in_button" android:layout

nullpointer exception raises when i click on the button

断了今生、忘了曾经 提交于 2019-12-28 04:37:25
问题 When I click on CheckData button on android, it is throwing a nullpointer exception . SaveData.java public class SaveData extends Activity implements OnClickListener { static final int DIALOG_ID = 0; private Uri mImageCaptureUri; private ImageView mImageView; public static class Certificates { private Bitmap bmp; public Certificates(Bitmap b) { bmp = b; } public Bitmap getBitmap() { return bmp; } } private static final int PICK_FROM_CAMERA = 1; private static final int PICK_FROM_FILE = 2;

question about change the colours of a button when clicked

可紊 提交于 2019-12-25 14:40:33
问题 My purpose is to change the color of a button when click and my codes are <?xml version="1.0" encoding="utf-8"?> selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- When selected, use grey --> <item android:drawable="@drawable/btn_askering_active" android:state_selected="true" /> <!-- When not selected, use white--> item android:drawable="@drawable/btn_askering" /> </selector> It works but if i make a small change like below : xmlns:android="http://schemas.android.com

When declaring buttons different fragments does not recognize

不想你离开。 提交于 2019-12-25 04:29:18
问题 I have a problem when declaring a button. I will try to explain as specific as possible. In my main Layout I have a Fragment containing a secondary Layout. In which I have several buttons. My intention is that my main fichero.java to declare the buttons within the fragment. Here we put the main Layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent

Highlight buttons on search

混江龙づ霸主 提交于 2019-12-25 04:26:44
问题 I am trying to implement search functionality in android to search for buttons. Usually, search is used to search listviews but I want to use it to search buttons. I have 118 buttons in my activity and there is an edittext (Search bar) on the top. Each button represents the symbol of a chemical element. eg : Cu = Copper Zn = Zinc O = Oxygen F = Fluorine Cl = Chlorine and 112 more.... This is what my activity looks like (This screen shot is just to better explain my problem and it is not the

How do I make my toggle button act like a radio button?

旧时模样 提交于 2019-12-25 02:02:45
问题 I have 2 toggle buttons in my code and I want to change the behavior such that when one is selected the other one is not and vice versa. (want it to work like a radio button ).Any idea on how I can go about it? Here's my java code for the same: public class DashboardManageListFragment extends Fragment implements OnClickListener,OnCheckedChangeListener { public final static String TAG_MANAGE_DASHBOARD_LIST_FRAGMENT = "ManageDashboardListFragment"; public final static String IS_PERSONAL =

Android App: Replace default button background with custom background in a Dialog Fragment

梦想的初衷 提交于 2019-12-25 01:49:59
问题 What I'm trying to do is change the default backgrounds of a custom DialogFragment that I have written. Normally, I would do this by changing the XML layout file, however, for a DialogFragment these buttons don't exist in the layout file. In essence, I'm trying to get access to the setPositiveButton, setNegativeButton and setNeutral buttons in order to modify them. Alternatively, I would next try to do this by getting them by id, however, since they aren't defined in a layout file, I do not

Android: how to hide title bar on button click

混江龙づ霸主 提交于 2019-12-24 19:39:54
问题 App crashing when using requestWindowFeature(Window.FEATURE_NO_TITLE); When using the button to make it full screen which when tries to hide the Title bar the app crashes static int vari = 0; public void fsc(){ ib = (ImageButton) findViewById(R.id.fulls); ib.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), "Full-Screen", Toast.LENGTH_LONG).show(); if(vari == 0) { requestWindowFeature(Window.FEATURE_NO_TITLE);

Calling Multiple Layouts in One Activity on 2 different Call Backs

ε祈祈猫儿з 提交于 2019-12-24 17:26:17
问题 what am doing is that am initializing a layout on the start of my activity. Whenever a button on that layout is clicked am initializing another layout in the same activity. Whenever i click the am doing some working regarding insertion of a database record. even on ignoring the database part am getting java null pointer exception in logcat. Kindly have a look and guide me package com.example.emp_management; import android.app.Activity; import android.content.ContentValues; import android

android how to make some space between buttons and make white line above each of them

守給你的承諾、 提交于 2019-12-24 16:35:27
问题 I have two buttons with xml background , i want to keep some space between them, because that are past exactly on each other , also i want to put white line above them , i will give you how i tried but it doesn't work with me <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="25dip" android:orientation="horizontal" android:weightSum="2" > <Button android:background="@drawable/button_selector" android:layout_width="fill_parent"