animation - Android. Extending FrameLayout. Couldn't find setter/getter for property xFraction exception -


I raised the framelayout class to create slide-in slide-ani animation on piece transition. I want to get xFraction value programmatically.

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; RelativeLayout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: layout_width = "match_parent" Android: layout_height = "match_parent" Android: orientation = "vertical" & gt; & Lt; ImageView Android: layout_width = "70dp" Android: Layout_heat = "70dp" Android: Layout_centerHoriginal = "True" Android: Layout_margintop = "15 DP" Android: src = "@ + Drawable / Logo" /> & Lt; Com.example.helpers.CustomFrameLayoutAndroid: id = "@ + id / fragment" Android: layout_width = "wrap_content" Android: layout_height = "match_parent" /> & Lt; / RelativeLayout & gt;   

looks like a custom frame layout

  Public category customframe layouts frameleout {Increase public custrefame layout (reference context, attribute value, int diffile) Is {super (context, ethers, diffile); // Tudo Auto-Generated Constructor Stub} Public Custom Frame Layouts (Reference Reference, Attribatets Atters) {Super (References, ethers); // Tudo Auto-Generated Creator Stub} Public Custom Frame Layouts (Reference Reference) {Super (Reference); // Tudo Auto-Generated Constructor Stub} Public Float getXFraction () {returnX () / getWidth (); } Public Zero setXFraction (Float Expression) {Final Full Width = getWidth (); Setx ((width> gt; 0)? (Excitation * width): -99 99); }}   

An exception is thrown when the animation is started after clicking on the button:

  Can not find the original method using JNI Use reflectionjava.lang. Some method method: No method with name = 'setXFraction' sign = '(F) V' in the class Landroid / widget / relative layout; 02-17 13: 57: 33.369: E / property valzerholder (12223): The type of value with the float could not get a setter / getter for expression expression   

- I think from there I got it but it does not work please

It seems that you try to call method Are: setXFraction () Parent / Relay layout on your com.example.helpers.CustomFrameLayout .

You should meet the context of your CustomFrameLayout in this way already the name of your parent's layout named parentRelativeLayout ):

  CustomFrameLayout customframe layout = (CustomFrameLayout) parentRelativeLayout.findViewById (R.id.fragment);   

You can now call setXFraction () on the appropriate reference, eg:

  customframeLayout.setXFraction (25.4) ;    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -