Skip to main content

Posts

Showing posts with the label align

How to move or put the android button in the middle of the screen

Ques: How to centre buttons on screen horizontally and vertically ? Default Screen: Ans: You need to use a Relative Layout for android GUI in the activity_fullscreen.xml   or whatever you name it. You just need to add the android:layout_centerInParent="true" on your relative layout scope. In default android generate the layout as linear layout for your GUI activity. In that activity you can't use android:layout_centerInParent="true". It will generate warning as --- Invalid layout param in a LinearLayout: layout_centerInParent    activity_fullscreen.xml    /YourProject/res/layout    line 52    Android Lint Problem How?:    Step 1. First open the layout xml from /YourProject/res/layout . Step 2. Change all of the <FrameLayout> ... </FrameLayout> to <RelativeLayout> ... </RelativeLayout> .  Step 3.  Delete default button code porti...