Bogenpass? Aufwendig? Wie umsetzen?

  • 41 Antworten
  • Letztes Antwortdatum
Genau sowas war gemeint. Ich denke mal ich werde mit @Bielefelder mal versuchen dieses Projekt umzusetzen. Bin auf dem Gebiet auch mehr als neu und habe nur ganz schwache Java Kenntnisse. Ist ja ein gutes Projekt um da reinzukommen denke ich.
 
Du solltest anfangen die Android Dev Seite durchzuarbeiten...
Dann sollte dir einiges klarer werden.

lg. Dagobert
 
Ich besuche seit Wochen immer diese Seite: Getting Started | Android Developers

Aber iwie fiel es mir in den jungen Jahren einfacher mich mit sowas ernsthaft auseinanderzusetzen... =/
 
Kann mir einer vielleicht erklären wo ich die Section1 finde?
Ich habe mit Eclipse das soweit hinbekommen das ich 9 Sections habe, die auch Viewpage hinundher geschoben werden können... aber ich finde einfach nicht die section1 um dort Inhalt reinzupacken.

Oder hab ich da ein falsches Verständnis. Stelle mir gerade so vor als sei die Section1 wie eine "HTML" Datei die man mit Inhalt füllt und dann dargestellt wird.
 
Von was für Sections meinst du? Von was redest du? ^^
 
Hahaha, so ähnlich denke ich auch gerade.
Ich habe mit Eclipse ein Neues Projekt erstellt, dann Frametabs + Swap oder so ausgewählt... Emuliert auf einem Testhandy zeigte er Anfangs direkt 3 Seiten an die man testen konnte. Dies stand im Code als title_section1... diese habe ich im Ordner Res/strings.xml erweiter auf nun 9 Sections...

Das heisst die App wird mir nun mit 9 swap / swipe baren Seiten angezeigt aber ich möchte natürlich nun Inhalt auf die Seite packen. Also Textforms.


<string name="app_name">Bogen Pass</string>

<string name="action_settings">Menü</string>

<string name="title_section1">Bogen</string>

<string name="title_section2">Visier</string>

<string name="title_section3">Stabilisation</string>

<string name="title_section4">Pfeile 1</string>

<string name="title_section5">Pfeile 2</string>

<string name="title_section6">Einstellungen</string>

<string name="title_section7">Zubehör</string>

<string name="title_section8">Bemerkungen</string>

<string name="title_section9">Besitzer</string>

 
Ahh verstehe :D
Also entweder setzt er dir unter /src/*.java iwo den inhalt oder unter /res/layout/*.xml

Am besten du machst mal nen screenshot vom Baum. (Also wie die ganzen datein aussehn und heißen)
Auerßdem sagst du uns, was du auf den einzlen sectionen siehst.. IWas oder nur farbe oder?!

Gruß
 
Also :) ...

Eigentlich hiess es ja Section 1 / Section 2 / Section2 und im Content Feld wird 1, 2 oder 3 angezeigt.
Dies hab ich ja geändert... Nun wird Bogen, Visier etc angezeigt und die Inhalte sind derzeit 1,2,3,4,5,6,7,8,9... ;)

Unter res/layout sind nur 2 Dateien activity_main.xml und fragment_main_dummy.xml

Ich denke das wird nichts mit mir und programmieren...

Bei HTML war es einfach. Einfach eine HTML erstellen zB Bogen.html und da den Inhalt rein und im Menü verlinkt ;-)
Ich dachte das Section1 eine "neue Seite" ist quasi.
 
Öffne mal die fragment_main_dummy.xml und poste den inhalt.

Sorry aber:
Ich denke das wird nichts mit mir und programmieren...

Bei HTML war es einfach. Einfach eine HTML erstellen zB Bogen.html und da den Inhalt rein und im Menü verlinkt ;-)
Ich dachte das Section1 eine "neue Seite" ist quasi.
Aber von den anderen hier erwarten, dass sie es für dich "mal schnell für umsonst" machen... Das ist so typisch.
"Yes I'm a Web Developer. No! I dont make websites for free!"

Gruß
 
Code:
[SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]
[LEFT]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]RelativeLayout[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]xmlns:android[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"http://schemas.android.com/apk/res/android"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]xmlns:tools[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"http://schemas.android.com/tools"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"match_parent"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"match_parent"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:paddingBottom[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@dimen/activity_vertical_margin"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:paddingLeft[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@dimen/activity_horizontal_margin"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:paddingRight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@dimen/activity_horizontal_margin"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:paddingTop[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@dimen/activity_vertical_margin"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]tools:context[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]".MainActivity$DummySectionFragment"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
[/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]TextView[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:id[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@+id/section_label"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/LEFT]
[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/LEFT]
[/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]</[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]RelativeLayout[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>
[/COLOR][/SIZE][/COLOR][/SIZE]
 
Also:
In deinem Java-Code hast du irgendwo sowas stehen:
Code:
TextView tv = (TextView) findViewById(R.id.section_label);
tv.setText(i);
i ist in dem fall eine Variable, die den wert von 1 bis 9 annimmt.

Du musst dir jetzt überlegen wie du es machen möchtest. Magst du lieber ein Layout, welches du beim wischen jeweils änderst. Oder 9 verschieden Layouts?
Ich habe letzteser immer lieber. Aber da müssten wir sehr viel code auseinander nehmen und ersetzten. Aber es ist übersichtlicher.

Am besten poste schon vorher mal deine *.java datei ;)

Aus Spaß kannst du schonmal machen:
Da wo das mit TextView blabla steht
Code:
if( i == 1) {
tv.setText("Seite 1");
} else if (i == 2) {
tv.setText("Sweite 2);
} else {
tv.setText("Dreckssseiten. Interessieren nicht");
}

Gruß
 
Inhalt der MainActivity.java
Code:
package com.example.bogenpass;
import java.util.Locale;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.NavUtils;
import android.support.v4.view.ViewPager;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class MainActivity extends FragmentActivity {
    /**
     * The [EMAIL="{@link"]{@link[/EMAIL] android.support.v4.view.PagerAdapter} that will provide
     * fragments for each of the sections. We use a
     * [EMAIL="{@link"]{@link[/EMAIL] android.support.v4.app.FragmentPagerAdapter} derivative, which
     * will keep every loaded fragment in memory. If this becomes too memory
     * intensive, it may be best to switch to a
     * [EMAIL="{@link"]{@link[/EMAIL] android.support.v4.app.FragmentStatePagerAdapter}.
     */
    SectionsPagerAdapter mSectionsPagerAdapter;
    /**
     * The [EMAIL="{@link"]{@link[/EMAIL] ViewPager} that will host the section contents.
     */
    ViewPager mViewPager;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Create the adapter that will return a fragment for each of the three
        // primary sections of the app.
        mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
        // Set up the ViewPager with the sections adapter.
        mViewPager = (ViewPager) findViewById(R.id.pager);
        mViewPager.setAdapter(mSectionsPagerAdapter);
    }
    @Override
    public 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;
    }
    
    
    /**
     * A [EMAIL="{@link"]{@link[/EMAIL] FragmentPagerAdapter} that returns a fragment corresponding to
     * one of the sections/tabs/pages.
     */
    public class SectionsPagerAdapter extends FragmentPagerAdapter {
        public SectionsPagerAdapter(FragmentManager fm) {
            super(fm);
        }
        @Override
        public Fragment getItem(int position) {
            // getItem is called to instantiate the fragment for the given page.
            // Return a DummySectionFragment (defined as a static inner class
            // below) with the page number as its lone argument.
            Fragment fragment = new DummySectionFragment();
            Bundle args = new Bundle();
            args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, position + 1);
            fragment.setArguments(args);
            return fragment;
        }
        @Override
        public int getCount() {
            // Show 9 total pages.
            return 9;
        }
        @Override
        public CharSequence getPageTitle(int position) {
            Locale l = Locale.getDefault();
            switch (position) {
                case 0:
                    return getString(R.string.title_section1).toUpperCase(l);
                case 1:
                    return getString(R.string.title_section2).toUpperCase(l);
                case 2:
                    return getString(R.string.title_section3).toUpperCase(l);
                case 3:
                    return getString(R.string.title_section4).toUpperCase(l);
                case 4:
                    return getString(R.string.title_section5).toUpperCase(l);
                case 5:
                    return getString(R.string.title_section6).toUpperCase(l);
                case 6:
                    return getString(R.string.title_section7).toUpperCase(l);
                case 7:
                    return getString(R.string.title_section8).toUpperCase(l);
                case 8:
                    return getString(R.string.title_section9).toUpperCase(l);
            }
            return null;
        }
    }
    /**
     * A dummy fragment representing a section of the app, but that simply
     * displays dummy text.
     */
    public static class DummySectionFragment extends Fragment {
        /**
         * The fragment argument representing the section number for this
         * fragment.
         */
        public static final String ARG_SECTION_NUMBER = "section_number";
        public DummySectionFragment() {
        }
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_main_dummy, container, false);
            TextView dummyTextView = (TextView) rootView.findViewById(R.id.section_label);
            dummyTextView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER)));
            return rootView;
        }
    }
}
 
new DummySectionFragment(); <- Die Klasse brauch ich :D
 
Naja, nochmal auf dein Satz von vorhin drauf zu kommen. Ich als Laie kann ja nicht wissen wie aufwendig so eine Programmierung wirklich ist.

Das was ich dir da ja zeige ist ja einfach nur das Ergebnis eines standardmäßig Neu erstellten Projekts + hinzufügen von title.sections.

Und da der das im Emulator schon "korrekt" anzeigt dachte ich mir brauch man einfach nur "Seiten" erstellen wo man die Textfelder über Eclipse Grafisch einfügt und dann läufts ^^
 
Oh man, ich merke schon...hier fehlen die grundlegendsten Kenntnisse bei uns @Bielefelder! :D

Ich finde selbst das Android Developer Training schon sehr fortgeschritten, alleine was einem Eclipse ADT schon an Code für eine einfache Hallo Welt Anwendung vorgibt! *schwitz*

Gibt es eine Möglichkeit, das iwo von der Pike auf zu lernen?! :(
 
Ja erst Java lernen,
dann ist Android auch nur ein "Framework" wenn auch ein sehr komplexes wie ich finde.

Aber schön das ihr merkt das eine App nicht mal ebend so zu machen ist.

lg. Dagobert
 
Naja das war mir direkt klar. Ich habe früher auch schon in Java programmiert, nur reicht es scheinbar nicht! XD
 
Leute, es muss doch wohl möglich sein, in einem höflichen und sachlichen Ton zu kommunizieren. Wer sich hier nicht an die Netiquette und die Forenregeln hält, wird sanktioniert.

Nach mir ist auch keine Form von Grundsatzdiskussion erwünscht...
 
  • Danke
Reaktionen: reneph
Zurück
Oben Unten