How to Create the Button in Android Studio. | Button | Android Studio.
How to Create a Button in Android studio.
To create Button
Code.XML:-
<Button
android:layout_width="200dp"
android:layout_height="60dp"
android:id="@+id/btn_submit"
android:layout_below="@id/et_password"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:textColor="#0A0A0A"
android:textSize="25dp"
android:text="submit" />
Code.java:-
1) Declare the Button
Button btn;
2)Set the Path
btn= findViewById(R.id.buttonone);
3) Clicking Activity
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(mainActivity.this,HomeActivity.class);
startActivity(i);
}
};
You can refer this video in Youtube:-
Comments
Post a Comment