how to change activity icon in android
Today learn an Example of how to change activity icon in android follow this example.
1.MainActivity.java:
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class MainActivity extends Activity implements OnCheckedChangeListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
// setting our activity to be full screen
setContentView(R.layout.activity_main);
}
}
2.Activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/taxi_back1">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/taxi_result"
android:layout_alignParentLeft="true"
android:layout_marginBottom="27dp"
android:text="Your Total Fare"
android:textColor="@android:color/black"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="20dp" />
<EditText
android:id="@+id/taxi__distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView2"
android:layout_alignParentLeft="true"
android:layout_marginBottom="26dp"
android:ems="10" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/taxi__distance"
android:layout_alignParentLeft="true"
android:text="Enter Distance"
android:textColor="@android:color/black"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="@+id/taxi_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/taxi_button"
android:layout_alignParentLeft="true"
android:layout_marginBottom="36dp"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="@+id/taxi_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignRight="@+id/textView2"
android:layout_marginBottom="36dp"
android:background="@android:color/darker_gray"
android:text="CALCULATE"
android:textAlignment="viewStart"
android:textColor="@android:color/black"
android:textSize="15dp" />
<Button
android:id="@+id/taxi_reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/taxi_result"
android:layout_toRightOf="@+id/taxi_result"
android:background="@android:color/darker_gray"
android:text="RESET"
android:textAlignment="viewStart"
android:textColor="@android:color/black"
android:textSize="15dp" />
<ImageButton
android:id="@+id/taxi_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/phone" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/taxi_phone"
android:orientation="horizontal"
android:paddingBottom="40px"
android:weightSum="2" >
<RadioGroup
android:id="@+id/taxi_rg1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<RadioButton
android:id="@+id/taxi_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DAY" />
<RadioButton
android:id="@+id/taxi_night"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NIGHT" />
</RadioGroup>
<RadioGroup
android:id="@+id/taxi_rg2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="70px" >
<RadioButton
android:id="@+id/taxi_ac"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AC" />
<RadioButton
android:id="@+id/taxi_nonac"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NON-AC" />
</RadioGroup>
</LinearLayout>
<ImageButton
android:id="@+id/taxi_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/taxi__distance"
android:src="@drawable/arrow" />
</RelativeLayout>
No comments:
Post a Comment