Okhelp.cz

Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

Get Resource ID by Resources String Name Android example


// image from res/drawable
	int resID = getResources().getIdentifier("my_image", 
			"drawable", getPackageName());
// view
	int resID = getResources().getIdentifier("my_resource", 
			"id", getPackageName());

// string
	int resID = getResources().getIdentifier("my_string", 
			"string", getPackageName());



396LW NO topic_id




AD

Další témata ....(Topics)


58

HorizontalScrollView ScrollView horizontal vertical Android xml example | horizontalscrollview-scrollview-horizontal-vertical-android-xml-example


HorizontalScrollView ScrollView LinearLayout horizontal vertical Android xml basic example and image.

[caption id="attachment_889" align="alignleft" width="200" caption="horizontal scrollview horizontalscrollview android"]android/horizontalscrollview-android-200x300.png[/caption]


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
	android:layout_width="fill_parent" android:layout_height="fill_parent"
	xmlns:android="//schemas.android.com/apk/res/android">

	// horizontal and vertical Scrollview
	<ScrollView android:id="@+id/ScrollView01"
		android:layout_height="135px" android:layout_width="wrap_content"
		android:scrollbars="horizontal|vertical">

		// HorizontalScrollview
		<HorizontalScrollView android:id="@+id/HorizontalScrollView01"
			android:layout_height="fill_parent" android:layout_width="wrap_content">

			<LinearLayout android:id="@+id/LinearLayout02"
				android:layout_width="wrap_content" android:orientation="vertical"
				android:layout_height="fill_parent">
				<LinearLayout android:orientation="horizontal"
					android:layout_width="fill_parent" android:layout_height="fill_parent"
					android:layout_weight="1">
					<TextView android:text="red" android:gravity="center_horizontal"
						android:background="#aa0000" android:layout_width="200px"
						android:layout_height="fill_parent" android:layout_weight="1" />
					<TextView android:text="green" android:gravity="center_horizontal"
						android:background="#00aa00" android:layout_width="200px"
						android:layout_height="fill_parent" android:layout_weight="1" />
					<TextView android:text="blue" android:gravity="center_horizontal"
						android:background="#0000aa" android:layout_width="200px"
						android:layout_height="fill_parent" android:layout_weight="1" />
					<TextView android:text="yellow" android:gravity="center_horizontal"
						android:background="#aaaa00" android:layout_width="200px"
						android:layout_height="fill_parent" android:layout_weight="1" />
				</LinearLayout>

				<LinearLayout android:orientation="vertical"
					android:layout_width="fill_parent" android:layout_height="fill_parent"
					android:layout_weight="1">
					<TextView android:text="row one" android:textSize="15pt"
						android:layout_width="fill_parent" android:layout_height="wrap_content"
						android:layout_weight="1" />
					<TextView android:text="row two" android:textSize="15pt"
						android:layout_width="fill_parent" android:layout_height="wrap_content"
						android:layout_weight="1" />
					<TextView android:text="row three" android:textSize="15pt"
						android:layout_width="fill_parent" android:layout_height="wrap_content"
						android:layout_weight="1" />
					<TextView android:text="row four" android:textSize="15pt"
						android:layout_width="fill_parent" android:layout_height="wrap_content"
						android:layout_weight="1" />
				</LinearLayout>


			</LinearLayout>
		</HorizontalScrollView>
	</ScrollView>
</LinearLayout>



Other sample


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="//schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/layout"
    android:orientation="vertical" >

    <HorizontalScrollView
        android:id="@+id/horizontalScrollView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="horizontal" >
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Hello world! First TextView" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Large Text"
            android:textAppearance="?android:attr/textAppearanceLarge" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Medium Text"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        </LinearLayout>



    </HorizontalScrollView>

</LinearLayout>

35

Android startup tutorial for developers video | android-startup-tutorial-for-developers-video


How install Android emulator on PC
//developer.android.com/sdk/installing.html

Download links:
Java Development Kit JDK download
Eclipse download
Android SDK download