android-button

Android Button Height in Layout not filling the parent

情到浓时终转凉″ 提交于 2019-12-01 01:47:49
I've Created this layout and I don't know why Button 's height not filling the layout height <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/pf_sm_dividor_light" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <RelativeLayout android:layout_width="match_parent" android:layout_height=

Changing button style in the whole application

若如初见. 提交于 2019-12-01 00:54:52
问题 I'm trying to change all the TextColor of my buttons in my app to white and also trying to make it bold. But that isn't happening, I'm overwriting the android:Widget.Button I'm developing for Jelly Bean 4.1.2 What am I doing wrong? Theme definition in manifest android:theme="@style/spui" > The theme where I like to <style name="spui" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:buttonStyle">@style/Buttonspui</item> </style> The style for the button itself <style name=

How to delete the last letter from EditText with button? [duplicate]

我只是一个虾纸丫 提交于 2019-11-30 20:49:07
This question already has an answer here: Android EditText - Delete the last letter with a button 4 answers I have to buttons that writes A and B to an edittext. If there is something in the edittext how can I delete the last letters with the "Del" button ? My 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" tools:context=".MainActivity" > <Button android:id="@+id/buttonb" android:layout_width="100dp" android:layout_height="100dp" android

NullPointerException on button's OnClickListener

只愿长相守 提交于 2019-11-30 18:46:35
I'm writing an Android game app for an Artificial Intelligence semester project. I'm getting a NullPointerException on Line 38 of the main class, which is the setOnClickListener for the new game button from the launch screen. Relevant sections Class WW3Activity: public class WW3Activity extends Activity { public boolean DebugMode = false; private String buildMenuEmplacement = ""; //[Initialization] Called when the app is first launched @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.startscreen); //[Initialization] Makes

what is the best way to do a button group that can be selected and activate independently?

时间秒杀一切 提交于 2019-11-30 18:25:06
I'm trying to do in android a group of buttons that can be selected and activate only one of them. I need to work with the same logic of a radiogroup and radiobuttons. I tried many alternatives but I want the most effective way. How can I do it? You can use this simple way : 1.activity_button_group.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal"> <Button android:layout_width="wrap_content" android:layout_height="wrap

How to change android button text color globally in theme

你离开我真会死。 提交于 2019-11-30 16:26:13
问题 How can I change all my buttons text color? I know I can set the background color like follows : <style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> ... <item name="colorButtonNormal">@color/buttonColor</item> </style> How can I do this for the button Text? 回答1: <style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:textColor">#yourcolor</item> <item name="android:buttonStyle">@style/ButtonColor</item> <item name="colorButtonNormal"

Android ListView with Checkboxes: How to capture checked items?

随声附和 提交于 2019-11-30 16:10:12
问题 I have to do a ListView with CheckBoxes and then display the checked and unchecked items when user presses the button. The problem is I don't know how to do it, I manage to display the ListView with the CheckBox with this code: package guestCheckBox.com; import java.net.URL; import java.util.ArrayList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom

How to change default color in all texts in my Android application?

天涯浪子 提交于 2019-11-30 12:50:33
问题 I would like to change all color texts in my application. So I wrote this code and I set my theme in the manifest: <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:textColor">@color/white</item> </style> But only TextView texts are in white. I would like Button and EditText to be in white too. Can anyone help me? Thank you in advance. 回答1: Your Theme: <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android

Button to go back to MainActivity

≯℡__Kan透↙ 提交于 2019-11-30 12:36:30
问题 I want to create a button that would lead the user straight back to main activity which doesn't have the android name="com.example.example". It has android.intent.etc... How can I reference my button to go back to this activity? 回答1: Lets say your main activity is called Main.java. btnBack.setOnClickListener(new OnClickListener(){ private void onClick(){ Intent intent = new Intent(currentActivity.this, Main.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } });

How to put two buttons on same line in Android

拥有回忆 提交于 2019-11-30 11:42:59
How can I place two buttons on the same line in my login layout on my Android application? Just make a linear layout.Set the orientation to horizontal and add two buttons.Its ready you will get what you want.Before posting such questions try googling you will get the answer for sure.This piece of code will help you. <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/button2" android:layout_width="wrap