Beiträge von blueangel230
-
-
Hier nun der Code:
Code
Alles anzeigen<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ScrollView2" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="wrap_content" > <LinearLayout android:id="@+id/LinearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@color/pmWhite" android:gravity="top" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:text="@string/pmname" android:textAppearance="?android:attr/textAppearanceSmall" android:textSize="10sp" /> <EditText android:id="@+id/editText1" style="@style/pmEditText1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="12dp" android:hint="@string/empty" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:text="@string/newBetrag" android:textAppearance="?android:attr/textAppearanceSmall" android:textSize="10sp" /> <EditText android:id="@+id/editTextBetrag" style="@style/pmEditText1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="30dp" android:ems="10" android:hint="@string/empty" android:inputType="numberDecimal" android:singleLine="true" /> </LinearLayout> </ScrollView>So wie der code jetzt ist geht es nicht. Mache ich textView2 unter editTextBetrag geht es wieder.
-
-
Hallo zusammen,
Ich hänge mal wieder an einem Problem und weis nicht wonach ich noch suchen soll.
Ich habe eine XML die folgend aufgebaut ist:
ScrollViewer
LinearLayout
hier dann diverse TextViews und EditViews
funktionierte beim Erstellen ganz gut. Nun wenn ich jetzt sagen wir mal am Anfang kommen 2 EditViews dann ein TextView - möchte ich nun die Textview zwischen den Beiden EditViews haben dann bekomme ich bei Ausführung class not Found
Kann man in einem LinearLayout die Inhalt nicht einfach anders anordnen also einfach andere Reihenfolge ?
-
Wollte mich ja zurückmelden.
Habe das jetzt verstanden
Danke nochmals für die Hilfe. -
Ok - Das hört sich doch schon mal ganz gut an. Ich werde mir das Tutorial ausführlich ansehen und Natürlich auch testen.
Danke für die Info -- Ich melde mich ob alles geklappt hat.
-
Habs jetzt zwar erstmal zum laufen gebracht aber ich verstehe glaube das Konzept dahinter nicht.
Ich habe die Methode jetzt in der Main stehen und auf einmal geht es.
Welcher Code kommt denn in die 2te Java code Datei ? und welcher in die Main.
bzw. kann man auch den code in die 2 te schreiben und irgendwie verlinken ??Sorry für diese Anfängerfragen aber der umstieg von c# auf Java fällt mir bissl schwer.
-
Klar kann ich den Quelltext liefern,
Habe um alle Fehler auszuschliessen ein komplett neues Projekt erstellt mit gleichem Fehler.
Ich denke mal das ICH da irgend was falsch mache.
Also das ist die Main: (von hier aus kann ich die 2te Seite aufrufen)
Code
Alles anzeigenimport android.os.Bundle; import android.app.Activity; import android.view.Menu;import android.view.View; public class MainActivity extends Activity { @Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);setContentView(R.layout.activity_main); } @Overridepublic boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.main, menu);return true; } public void testklick (View view){setContentView(R.layout.activity_over); } }Code
Alles anzeigen<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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginLeft="30dp" android:layout_marginTop="132dp" android:onClick="testklick" android:text="Button" /> </RelativeLayout>
und die 2te Seite:(von hier aus kann ich nicht auf die erste zurück allerdings koennte die Methode auch leer sein er wirft vorher die besagte Meldung raus)Code
Alles anzeigenimport android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.MenuItem; import android.view.View;import android.support.v4.app.NavUtils; public class OverActivity extends Activity { @Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);setContentView(R.layout.activity_over); // Show the Up button in the action bar. setupActionBar(); } /** * Set up the {@link android.app.ActionBar}. */private void setupActionBar() { getActionBar().setDisplayHomeAsUpEnabled(true); } @Overridepublic boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.over, menu);return true; } @Overridepublic boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) {case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back //NavUtils.navigateUpFromSameTask(this);return true; }return super.onOptionsItemSelected(item); } public void test2klick(View view){setContentView(R.layout.activity_main); } }Code
Alles anzeigen<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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".OverActivity" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginLeft="46dp" android:layout_marginTop="74dp" android:onClick="test2klick" android:text="Button" /> </RelativeLayout>
Danke euch fürs drüberschauen -
Das ist ja das komische. Die Imports sind alle vorhanden.
Hab auch mal testweise andere activitys erstellt und überall das gleiche Problem das der onClick nur auf der Main Funktioniert.Bin bei Android noch recht neu. Erstelle sonst apps für WP und W8 und möchte diese jetzt halt portieren.
-
Hallo zusammen,
Stecke noch ziemlich am Anfang und stecke schon nach kurzer Zeit fest.
Ich möchte erstmal nur zu Lernzwecken folgendes haben.
MainActivity - mit nem Button drauf der ne 2 te SecondActivity öffnet. (Das klappt ganz gut)
nun soll aber auf der 2 ten Activity also der SecondActivity auch ein Button drauf der die MainActivity wieder öffnet. Das will leider nicht klappen. Da kommt dann der Debugger und sagt immer "Source not Found" View class.
View ist aber eingebunden genauso wie bei der Main. Alles gleich , mehrfach kontrolliert. Woran kann das liegen oder hab ich da Irgendwas nicht verstanden.
Habe in der SecondActivity folgende Methode:
public void testKlick(View view){
}
aufgerufen wird das beim Button android:onClick="testKlick"
also auch wenn die Methode leer ist wird die besagte Exception ausgeworfen.
Hoffe ihr habt ne Lösung
Gruss Robert