Sie sind auf Seite 1von 3

Activity main version 1:

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/tab_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<!-- Framelayout to display Fragments -->


<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<!-- Listview to display slider menu -->
<!-- divider:Drawable or color to draw between list items -->
<!-- choicemode:One item in a selected state -->
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@color/list_divider"
android:dividerHeight="1dp"
android:listSelector="@drawable/list_selector"
android:background="@color/list_background"/>
</android.support.v4.widget.DrawerLayout>

Bold text:
TextView questionValue = (TextView) findViewById(R.layout.TextView01);
questionValue.setTypeface(null, Typeface.BOLD);
android:textStyle="bold"
android:textStyle="italic"
For list views:

state_selected is used when an item is selected using a keyboard/dpad/trackball/etc.


state_activated is used when View.setActivated(true) is called. This is used for
"persistent selection" (see Settings on tablet for instance)
state_pressed is used when the user is pressing the item either through touch or a
keyboard or a mouse
state_focused is used if the item is marked focusable and it receives focus either
through the user of a keyboard/dpad/trackball/etc. or if the item is focusable in touch mode

Oncreate:

Every Activity you make is started through a sequence of method calls. onCreate() is the
first of these calls.
Each and every one of your Activities extends android.app.Activity either directly or by
subclassing another subclass of Activity.
In Java, when you inherit from a class, you can override its methods to run your own code in
them. A very common example of this is the overriding of the toString() method when
extending java.lang.Object.
When we override a method, we have the option of completely replacing the method in our
class, or of extending the existing parent class' method. By calling
super.onCreate(savedInstanceState);, you tell the Dalvik VM to run your code in
addition to the existing code in the onCreate() of the parent class. If you leave out this line,
then only your code is run. The existing code is ignored completely.
However, you must include this super call in your method, because if you don't then the
onCreate() code in Activity is never run, and your app will run into all sorts of problem
like having no Context assigned to the Activity (though you'll hit a
SuperNotCalledException before you have a chance to figure out that you have no
context).
In short, Android's own classes can be incredibly complex. The code in the framework classes
handles stuff like UI drawing, house cleaning and maintaining the Activity and application
lifecycles. super calls allow developers to run this complex code behind the scenes, while
still providing a good level of abstraction for our own apps.
Button button= (Button) findViewById(R.id.menubutton);
button.setOnClickListener ( new OnClickListener(){
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(),"It is called a
Toast",Toast.LENGTH_LONG).show();
}
});

// TODO Auto-generated method stub

Das könnte Ihnen auch gefallen