Professional Documents
Culture Documents
APLIKASI MOBILE
“ Style Dan Theme “
Disusun oleh:
TEKNIK INFORMATIKA
POLITEKNIK NEGERI TANAH LAUT
2018
1. Source Code :
Activity main.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/pixel_google"
android:scaleType="fitXY"/>
<TextView
style="@style/TextContent.Small.White"
android:padding="8dp"
android:text="@string/_6_photos"
android:gravity="center_vertical"
android:drawableLeft="@drawable/ic_collections_white_18dp"
android:drawablePadding="4dp"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:background="#4D000000"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginBottom="@dimen/ctivity_vertical_margin"
android:layout_gravity="bottom" />
</FrameLayout>
<TextView
style="@style/TextContent.Black"
android:textSize="32sp"
android:text="@string/_735"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginBottom="8dp"/>
<TextView
style="@style/TextContent.Subtitle"
android:text="@string/stock_hanya_5_buah"
android:layout_marginBottom="@dimen/activity_vertical_margin"/>
<TextView
style="@style/TextContent"
android:text="@string/content_text"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:lineSpacingMultiplier="1"
android:textColor="@android:color/black"/>
<TextView
style="@style/TextContent.Subtitle"
android:text="@string/spesifikasi"
android:layout_marginBottom="8dp"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
<TextView
style="@style/TextSpec.Field"
android:text="@string/display"/>
<TextView
style="@style/TextSpec.Value"
android:text="@string/content_specs_display"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
<TextView
style="@style/TextSpec.Field"
android:text="@string/size"/>
<TextView
style="@style/TextSpec.Value"
android:text="@string/content_specs_size"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
<TextView
style="@style/TextSpec.Field"
android:text="@string/battery"/>
<TextView
style="@style/TextSpec.Value"
android:text="@string/content_specs_battery"/>
</TableRow>
</TableLayout>
<TextView
style="@style/TextContent.Subtitle"
android:text="@string/dijual_oleh"
android:layout_marginBottom="8dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="56dp"
android:layout_height="56dp"
android:src="@drawable/photo_2"
android:layout_centerVertical="true"
android:id="@+id/profile_image"
android:layout_marginRight="@dimen/activity_horizontal_margin"/>
<TextView
style="@style/TextContent"
android:layout_toRightOf="@id/profile_image"
android:text="@string/narenda_wicaksono"
android:layout_centerVertical="true"/>
</RelativeLayout>
<Button
style="@style/ButtonGeneral"
android:text="Beli"/>
</LinearLayout>
</ScrollView>
MainActivity.Java
package com.example.emiliyana.myviewandviewsmila;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().setTitle("Google Pixel");
}
}
Styles.xml
<resources>
Strings.xml
<resources>
<string name="app_name">MyViewAndViews</string>
<string name="content_text">Google officially announced its much-
anticipated Pixel phones; the Pixel and Pixel XL, on October 4. We attended
Google’s London UK event, mirroring the main one taking place in San
Francisco, US, where the firm unwrapped the new Android 7.1 Nougat devices
which will apparently usurp Google’s long-standing Nexus series.</string>
<string name="content_specs_display">5.0 inches\n
FHD AMOLED at 441ppi\n
2.5D Corning® Gorilla® Glass 4</string>
<string name="content_specs_size">5.6 x 2.7 x 0.2 ~ 0.3 inches 143.8 x
69.5 x 7.3 ~ 8.5 mm</string>
<string name="content_specs_battery">2,770 mAh battery\n
Standby time (LTE): up to 19 days\n
Talk time (3g/WCDMA): up to 26 hours\n
Internet use time (Wi-Fi): up to 13 hours\n
Internet use time (LTE): up to 13 hours\n
Video playback: up to 13 hours\n
Audio playback (via headset): up to 110 hours\n
Fast charging: up to 7 hours of use from only 15 minutes of
charging</string>
<string name="stock_hanya_5_buah">Stock hanya 5 buah</string>
<string name="spesifikasi">Spesifikasi</string>
<string name="display">Display</string>
<string name="size">Size</string>
<string name="battery">Battery</string>
<string name="dijual_oleh">Dijual oleh</string>
<string name="narenda_wicaksono">Narenda Wicaksono</string>
<string name="beli">Beli</string>
<string name="_735">$735</string>
<string name="_6_photos">6 photos</string>
</resources>
Colors.xml
Dimens.xml
android {
compileSdkVersion 25
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.example.emiliyana.myviewandviewsmila"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'de.hdodenhof:circleimageview:2.1.0'
}
2. Hasil :
3. Kesimpulan :
Dari latihan diatas dapat disimpulkan bahwa untuk belajar prinsip desain yang ada di
android dan implementasinya harus mematuhi kaidah yang di tetapkan oleh Design
Guideline yang dibuat oleh tim android di google. Untuk mengembangkan android harus
memperhatikan langkah-langkah seperti desain yang baik untuk interface, responsif, sesuai
dengan kebutuhan pengguna, optimasi menggunakan baterai dan koneksi jaringan yang
efisien.
4. QUIZ :