Sunday 15 March 2015

"error: No resource identifier found for attribute 'layout_margintop' in package 'android' " error in android eclipse -



"error: No resource identifier found for attribute 'layout_margintop' in package 'android' " error in android eclipse -

error: no resource identifier found attribute 'layout_margintop' in bundle 'android' error im getting in android eclipse in ubuntu. how prepare this?

i forgot mention have android:layout_margintop="60dp" in code on same xml file still not working

edit- fixed error getting says mpageradapter =new pageradapter(this.getsupportfragmentmanager(), fragments); pageradapter cannot initialised , pageadapter beingness underlined. quick prepare says rename in file dont think works or rename to? help appreciated!

package info.androidhive.slidingmenu; import java.util.list; import java.util.vector; import android.util.log; import android.app.fragment; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.support.v4.view.pageradapter; import android.support.v4.view.viewpager; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; public class findpeoplefragment extends fragmentactivity { private pageradapter mpageradapter; public findpeoplefragment(){} @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.order_form); initialisepaging(); homecoming ; } private void initialisepaging() { // todo auto-generated method stub list<fragment> fragments = new vector<fragment>(); fragments.add(fragment.instantiate(this,order_form2.class.getname())); mpageradapter =new pageradapter(this.getsupportfragmentmanager(), fragments); viewpager pager = (viewpager) findviewbyid(r.id.viewpager); pager.setadapter(mpageradapter); }

}

here xml file

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/list_background_pressed" > <relativelayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerhorizontal="true" android:layout_centervertical="true" android:layout_marginbottom="16dp" android:layout_marginleft="16dp" android:background="@drawable/layout_bg" android:orientation="vertical" > <android.support.v4.view.viewpager android:id="@+id/viewpager" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <edittext android:id="@+id/edittext1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:layout_marginleft="10dp" android:layout_marginright="10dp" android:layout_margintop="44dp" android:ems="10" android:inputtype="textpersonname" android:hint="@string/first_name" android:background="@drawable/edittext" > <requestfocus /> </edittext> <edittext android:id="@+id/edittext2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_below="@+id/edittext1" android:layout_marginleft="10dp" android:layout_marginright="10dp" android:layout_margintop="10dp" android:ems="10" android:hint="@string/last_name" android:inputtype="textpersonname" android:background="@drawable/edittext" /> <checkbox android:id="@+id/checkbox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/edittext2" android:layout_margintop="10dp" android:text="@string/malebutton" /> <checkbox android:id="@+id/checkbox2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbaseline="@+id/checkbox1" android:layout_alignbottom="@+id/checkbox1" android:layout_marginleft="14dp" android:layout_torightof="@+id/checkbox1" android:text="@string/femalebutton" /> <edittext android:id="@+id/edittext3" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignleft="@+id/edittext2" android:layout_below="@+id/checkbox1" android:layout_margintop="10dp" android:layout_marginright="10dp" android:background="@drawable/edittext" android:ems="10" android:hint="@string/phonenumber" android:inputtype="phone" /> <edittext android:id="@+id/edittext4" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignleft="@+id/edittext3" android:layout_below="@+id/edittext3" android:layout_marginright="10dp" android:layout_margintop="10dp" android:background="@drawable/edittext" android:ems="10" android:inputtype="textemailaddress" android:hint="@string/email_line" /> <edittext android:id="@+id/edittext5" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignleft="@+id/edittext4" android:layout_below="@+id/edittext4" android:layout_marginright="10dp" android:layout_margintop="10dp" android:background="@drawable/edittext" android:ems="10" android:hint="@string/affiliate_id" /> <checkbox android:id="@+id/checkbox3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/edittext5" android:layout_margintop="10dp" android:text="@string/checkbox3" /> <checkbox android:id="@+id/checkbox4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/checkbox3" android:layout_margintop="10dp" android:text="@string/checkbox4" /> </relativelayout> </relativelayout>

breakdown of available arguments android xml layouts:

in = inches on physical screen - not recommended

pt = 1/72 of inch on physical screen

mm = millimeters on physical screen

px = pixels - varies in size because of different screen densities , sizes android devices

dp = dip = density-independant-pixels - best bet cases

sp = dp depends on font size preference

your answer. create android:layout_marginleft="10dp", note number stays same. not appear much on tablet phone. advise on android developer website

for updated question, create sure android:layout_margintop="10dp", case sensitive. if not, create sure these nowadays in first line, , first tag follows

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"

android eclipse tags android-viewpager margin

No comments:

Post a Comment