android-button

How to remove v7 toolbar back button [closed]

丶灬走出姿态 提交于 2019-12-10 03:08:59
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago . I need to delete this v7 toolbar from my activity: Please Help me ! 回答1: If you are using v7 Toolbar you can remove this button with this code : if (getSupportActionBar() != null) { ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(false); } you can read android here

Why does maxWidth on a Button not work and how to work around it?

让人想犯罪 __ 提交于 2019-12-10 01:34:57
问题 I have two buttons on the layout, and on a large-screen device (tablets) I want to cap their width so they don't look ridiculous. I expected to use the maxWidth attribute but it apparently does nothing in my scenario. Here's the layout definition - the buttons use up the full width of the layout, ignoring any value in maxWidth. <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <Button android:layout_width="0dp" android

How to change the color of the color button when pressed in Android?

こ雲淡風輕ζ 提交于 2019-12-09 16:14:15
问题 I have some buttons which I set its background color as red, green and blue separately. When I press the button, click event is generated, but there is no change in gui for the user to know the button is pressed. Android button’s default background grayish color changes to orange and come back to grayish color after releasing the pressed state. How to implement this on colored button? 回答1: That is implemented via a StateListDrawable , represented by selector in XML . Reference: http:/

how to redirect to particular URL while clicking on button in android?

可紊 提交于 2019-12-09 10:15:25
问题 I want to redirect user to particular URL while clicking on Button in Android App. 回答1: You can start a 'view' activity, which would be the browser given a URL: public class HelloWorld extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Assuming you are using xml layout Button button = (Button)findViewById(R.id.Button01); button.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { Intent viewIntent = new

Android : Decreasing size of the Button

纵然是瞬间 提交于 2019-12-09 07:43:00
问题 I am using Button in one of the layouts. I want Button size to be as small as the text/label size. I am using the following code. <Button android:text="@string/cancle_button" android:id="@+id/button1" android:background="@drawable/back_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:textSize="12sp" android:textColor="#ffffff" android:textStyle="bold" /> But I want Button height to be same as text/label height. Whenever I

implement android:src=“@drawable/image” programmatically in Android

拈花ヽ惹草 提交于 2019-12-09 04:17:30
问题 I am trying to set the foreground image on an image button. After some research, I came across this code sample: <ImageButton android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon"/> My query is how to actually implement android:src in code. 回答1: Try this: ImageButton btn = (ImageButton)findViewById(R.id.button1); btn.setImageResource(R.drawable.newimage); where newimage is the image name in

Remove text padding in Button view

让人想犯罪 __ 提交于 2019-12-09 02:36:42
问题 I would like to remove the padding around text in Button view. The first screenshot is the result I would achieve, and the second one is the state of the art. Of course, I have defined a custom drawable to get the button appearance. But even if I set the padding attribute to 0dp the result does not change. Any suggestion, please? EDIT Here is the xml code of the button <Button android:id="@+id/btnCancel" style="@style/dark_header_button" android:layout_width="wrap_content" android:layout

Android checkbox checked in one activity and then button appears in another activity

断了今生、忘了曾经 提交于 2019-12-08 16:45:30
问题 The question says it all. Imagine there are 2 activity's, 'Activity A' and 'Activity B'.'Activity A' holds a checkbox when its checked a button should show on 'Activity B' when its unchecked the button should hide on 'Activity B' below is the main activity public class MainActivity extends ActionBarActivity { private BubblesManager bubblesManager; private boolean isCheckedValue; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R

how to make a ios dial pad interface in android

余生长醉 提交于 2019-12-08 11:08:21
问题 i want to make a dial pad just like IOS 7 in android with circle button. Any one can help me to make a circle button dial pad interface with different mobile screen supported in android. 回答1: It will take a lot of time if I want to write the code for that dial pad. So I write some steps that might help you plus some parts of a code that can show you the way: Make 2 drawable shape files. 2 oval shapes for buttons. (1 for default the other for pressed state) <?xml version="1.0" encoding="utf-8"

Adding more Buttons when a Button in clicked

坚强是说给别人听的谎言 提交于 2019-12-08 10:57:55
问题 Please look at the following algorithm and tell me if I can achieve it: create a main_activity inside the main_activity, create a simple Button the Button is labeled as "Add Button" once the users clicks the Button, an additional Button is created and placed in the Activity. In other words: once the user clicks on the add Button, it should create another Button and place it under the "Add Button" Button. I apologize in advance as this may be confusing, so please feel free to comment and ask