Custom Buttons - Error in Java - widget.Button; -
Emulator Accidents with - Extensive-class class android.widget.Button
Import android.os.Bundle ;. Import android.content.Intent; Import android App Import android.view.MenuInflater; Import android.view.MenuItem; Import android.view.View; Import android.view.View.OnClickListener; Import android.widget.Button; Public class master activity (button uccBtn, tipBtn; @ Override protected void saved create (bundled Instansstet) {Suprknkret (saved Instensstet); setContentView (R.layout.activity_master); UccBtn = (Button) searches Vivibiaiaidi ( RB Button 1) Tip BTN = (VBIID) (R.B. button 2); UccBtn.setOnClickListener (uccApp); TipBtn.setOnClickListener (tipApp); Custom.xml & lt ;? Xml version = " 1.0 "encoding =" UTF-8 "? & Gt; Selector xmlns: Android =" http://schemas.android.com/apk/res/android "& gt; & gt; item android: state_pressed =" Tr Ue "Android: drawable =" @ drawable / btn_ecolab_selected "> -
- android: state_focused =" true "Android: drawable =" @ drawable / btn_ecolab_highlight ">
Item: Android: Dragon = "@ Draubable / BTN_Calab"> & Lt; TextView android: id = "@ + id / textView1" Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" Android: layout_alignParentBottom = "true" Android: layout_centerHorizontal = "true" android: text = "@ string / Version" Android: Text Appointment = "? Android: ATR / Text APPRsSol" /> & Lt; Button android: id = "@ + id / button10" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_alignLeft = "@ + id / Button1" Android: layout_below = "@ + id / Button1" Android: Layout_marginTop = "56dp" Android: text = "@ string / button10" Android: typefaces = "serif" Android: background = "@ drawable / custom" /> & Lt; Button android: id = "@ + id / Button2" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_below = "@ + id / button10" Android: layout_centerHorizontal = "true" Android: layout_marginTop = "59 DP "Android: Text =" @ String / Button 2 "Android: Typeface =" Serif "Android: Background =" @ Drable / Custom "/> & Lt; / RelativeLayout & gt; If I only reference the button by name (BTn_Akalob), it works fine, when pressed or selected, not just animation. I have tried it with a linear goal to ensure that the Relitavelayout problem was not in the Custom button in my res / drawable-hpdi folder. Apart from this, in the MDPI, -xhdpi and -xxhdpi buttons and custom.xml copy tried. Tried without work @string.
After the
try this one.
find uccBtn = (button) VVBIID (R.B. button1); Tip BTN = (button) VBiID (R.B. button2); UccBtn.setOnClickListener (New OnClickListener) {@Override Click Public Zero (see V) {// Your code is here}}); By putting a folder drawable in the race folder, your custom.xml I am using this way and do great work .
Comments
Post a Comment