android - Regarding layout weight and margins -


why when set attribute layout_marginstart="130dp" of button whole upper edittext shifts accordingly?

2- i'm planning have screen divided 4 sections, total weight = 9 , sections 1,2,3,4 should has 2/9,2/9,4/9,1/9 accordingly. please let me know if need modify something.

xml:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightsum="9" tools:context="${relativepackage}.${activityclass}" >  <tablelayout      android:id="@+id/table_0"     android:layout_width="match_parent"     android:layout_height="0dp"     android:layout_weight="4">     <tablerow          android:id="@+id/row0"         android:layout_width="match_parent"         android:layout_height="wrap_content">         <textview              android:id="@+id/tv_ip"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_marginstart="5dp"             android:paddingtop="15dp"             android:text="ip: "/>         <edittext              android:id="@+id/et_ip"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:ems="12"/>     </tablerow>      <tablerow          android:id="@+id/row1"         android:layout_width="match_parent"         android:layout_height="wrap_content">         <textview              android:id="@+id/tv_port"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:layout_marginstart="5dp"             android:paddingtop="15dp"             android:text="port: "/>         <edittext              android:id="@+id/et_port"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:ems="12"/>     </tablerow>      <tablerow          android:id="@+id/row2"         android:layout_width="match_parent"         android:layout_height="wrap_content">         <textview              android:id="@+id/tv_clientid"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:layout_marginstart="5dp"             android:paddingtop="15dp"             android:text="client_id"/>         <edittext              android:id="@+id/et_clientid"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:ems="12"/>     </tablerow>      <tablerow          android:id="@+id/row3"         android:layout_width="match_parent"         android:layout_height="wrap_content">         <textview              android:id="@+id/tv_cleansession"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:layout_marginstart="5dp"             android:paddingtop="15dp"             android:text="clean session"/>         <checkbox             android:id="@+id/cbx_cleansession"             android:layout_width="match_parent"             android:layout_height="wrap_content"/>     </tablerow>      <tablerow          android:id="@+id/row4"         android:layout_width="match_parent"         android:layout_height="wrap_content">         <button             android:id="@+id/btn_conn"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:layout_marginstart="130dp"             android:gravity="center_vertical|center_horizontal"             android:text="connect"/>         </tablerow> </tablelayout> 

1 . end layout bottom

</lenearlayout> 
  1. you have max api virsion 17 use of android:layout_marginstart="5dp" . if want not change api virsion use android:layout_marginleft=5dp.

  2. dont use textview showing clean session. use this.

    `

        <checkbox         android:id="@+id/cbx_cleansession"         android:layout_width="match_parent"         android:text="clean session"         android:layout_height="wrap_content"/> </tablerow>` 
  3. last 1 thing can use edittext , give hint. , if want make better can use background templates .

that's it. hope it


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -