"error: No resource identifier found for attribute 'layout_margintop' im Paket 'android' " - Fehler in android-eclipse
error: No resource identifier found for attribute 'layout_margintop' im Paket 'android' ist der Fehler im immer in android eclipse in ubuntu. wie kann ich dieses Problem beheben?
Ich vergaß zu erwähnen, ich habe android:layout_marginTop="60dp" in der code-als auch auf der gleichen xml-Datei, aber seine immer noch nicht funktioniert
Bearbeiten - Dank ich fest, dass der Fehler jetzt bin ich immer einen anderen, wo es heißt mPagerAdapter =new PagerAdapter(dies.getSupportFragmentManager(), Fragmente); die PagerAdapter kann nicht initialisiert werden und nur PageAdapter wird Unterstrichen. die "quick fix", sagt umbenennen in Datei, aber ich glaube nicht, dass das funktioniert, oder was würde ich es umbenennen? Ihre Hilfe ist sehr geschätzt!
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();
return ;
}
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);
}
}
hier ist die xml-Datei
<?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>
- können Sie Ihre gesamte post layout.xml Datei
Du musst angemeldet sein, um einen Kommentar abzugeben.
Aufteilung der zur Verfügung stehenden Argumente für android xml layouts:
in
= Zoll auf körperliche Bildschirm - nicht zu empfehlenpt
= 1/72 Zoll auf der physische Bildschirmmm
= Millimeter auf der physische Bildschirmpx
= Pixel - variiert in der Größe, weil von all den verschiedenen Bildschirmauflösungen und-Größen für AndroidGeräte
dp
=dip
= Dichte-unabhängige-Pixel - Ihre beste Wette für die meisten Fällesp
= wiedp
sondern hängt von schriftart, Größe PräferenzIhre Antwort. machen Sie es
android:layout_marginLeft="10dp"
beachten Sie, dass diese Anzahl die gleiche bleibt. Es wird nicht angezeigt, zu wie viel auf einem Tablet als einem Telefon. Ich würde raten, auf der android-website für EntwicklerFür Ihren aktualisierten Frage, stellen Sie sicher, es ist
android:layout_marginTop="10dp"
groß-und Kleinschreibung.Wenn nicht, stellen Sie sicher, dass diese vorhanden sind, in der ersten Zeile und ersten tag wie folgt
http://developer.android.com/guide/topics/ui/declaring-layout.html#SizePaddingMargins
Diese geben Ihnen einen guten Ausgangspunkt für die Beantwortung Ihrer Frage.
Fehlermeldung, ohne Zweifel, weil Sie keine Einheiten angegeben.. versuchen "10sp" oder "10dp"