how can I set the margin of a EditText using xml?

hi all i have created layout using following code

        <EditText android:layout_height="wrap_content"
        android:padding="12dip"  android:layout_width="wrap_content" android:text="EditText" android:id="@+id/editText1"></EditText>
<TableRow android:layout_width="match_parent" android:id="@+id/tableRow2" android:layout_height="wrap_content">
    <TextView android:text="TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textView2"></TextView>
    <EditText android:text="EditText" android:id="@+id/editText2" android:layout_width="wrap_content" android:layout_height="wrap_content"></EditText>
<TableRow android:layout_width="match_parent" android:id="@+id/tableRow3" android:layout_height="wrap_content">
    <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
    <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>

but now i want to set the can I do this using XML?

  • Android Microsoft Office Library (.doc, .docx, .xls, .ppt, etc.)
  • Android adding footer to ListView addFooterView()?
  • List all camera images in Android
  • App is misconfigured for Facebook login: Android Facebook integration issue
  • Integration of android ndk's ndk-gdb with emacs?
  • Android turn On/Off WiFi HotSpot programmatically
  • Fixed Button below a scrollable ListView
  • ActionBarSherlock - actionbar custom background with divider
  • Prevent USSD dialog and read USSD response?
  • How to change background color in android app
  • Error Building Project in Android Studio "Error: No resource found that matches the given name (at ____ with value '@drawable/<name>')
  • Installing ADT plugin in Eclipse for Android development
  • 3 Solutions collect form web for “how can I set the margin of a EditText using xml?”

    Try this for left margin the second one in similar:

        android:text="EditText" > 

    Try this for Right_margin

    android:layout_marginRight = "15dip"

    Try this for left margin

    android:layout_marginLeft = "15dip"

    if you give value in center

    android:gravity = "center_horizontal"

    Android guidelines now suggest to use marginStart and marginEnd instead of left and right, so:

    android:layout_marginStart = "15dp"
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.