I want to create following layout.
--------------------------------
Title
Summary Info
[Get Direction][Call][More Info]
--------------------------------
I code following layout but buttons not showing. I have no idea why LinearLayout works like FrameLayout so the RelativeLayout hides buttons. Did I miss something here?
I am using support library 22.1
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="#dimen/location_card_height">
<ImageView android:id="#+id/cardImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="center"
android:layout_gravity="center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom" >
<TextView android:id="#+id/title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textAppearance="?android:attr/textAppearanceLargeInverse"
android:singleLine="true"
android:hint="Title" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#id/title">
<TextView android:id="#+id/info"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textAppearance="?android:attr/textAppearance"
android:singleLine="true"
android:hint="Info"
android:layout_alignParentRight="true"
android:ellipsize="end" />
<TextView android:id="#+id/summary"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textAppearance="?android:attr/textAppearance"
android:singleLine="true"
android:hint="Summary"
android:layout_toLeftOf="#id/info"
android:ellipsize="end" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/panelAction"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/btnDirection"
android:text="#string/get_direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/btnCall"
android:text="#string/label_call"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/btnMoreInfo"
android:text="#string/more_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
Your relative layout has been set to match_parent for it height!
change it to wrap_content
that should help you
or put it in a LinearLayout
something like this :
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="#dimen/location_card_height">
<ImageView android:id="#+id/cardImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="center"
android:layout_gravity="center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="5"
android:orientation="vertical" >
<RelativeLayout
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom" >
<TextView android:id="#+id/title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textAppearance="?android:attr/textAppearanceLargeInverse"
android:singleLine="true"
android:hint="Title" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#id/title">
<TextView android:id="#+id/info"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textAppearance="?android:attr/textAppearance"
android:singleLine="true"
android:hint="Info"
android:layout_alignParentRight="true"
android:ellipsize="end" />
<TextView android:id="#+id/summary"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textAppearance="?android:attr/textAppearance"
android:singleLine="true"
android:hint="Summary"
android:layout_toLeftOf="#id/info"
android:ellipsize="end" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/panelAction"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<Button
android:id="#+id/btnDirection"
android:text="#string/get_direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/btnCall"
android:text="#string/label_call"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/btnMoreInfo"
android:text="#string/more_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
If you are fine With Linearlayout Then Here is Your XML file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1" >
<ImageView
android:id="#+id/cardImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:scaleType="center"
android:src="#drawable/ic_launcher" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="#+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:singleLine="true"
android:text="Title"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/summary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="#id/info"
android:layout_weight="1"
android:ellipsize="end"
android:hint="Summary"
android:singleLine="true"
android:text="Summary"
android:textAppearance="?android:attr/textAppearance" />
<TextView
android:id="#+id/info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="right"
android:hint="Info"
android:singleLine="true"
android:text="Info"
android:textAppearance="?android:attr/textAppearance" />
</TableRow>
</LinearLayout>
<LinearLayout
android:id="#+id/panelAction"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="bottom" >
<Button
android:id="#+id/btnDirection"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Get_direction" />
<Button
android:id="#+id/btnCall"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="call" />
<Button
android:id="#+id/btnMoreInfo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="more_info" />
</LinearLayout>
Related
I have been using this code inside Co-ordinatorLayout, with no issues. I tried tweaking the code to work inside ConstraintLayout. While displaying Snackbar, the Snackbar is overlapping FAB. Also, I am unable to auto hide Toolbar. Can someone guide on how to auto-hide Toolbar and FAB inside ConstraintLayout.
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/acbl_layout_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sample.android.ActivitySample">
<!--Toolbar-->
<android.support.design.widget.AppBarLayout
android:id="#+id/acbl_layout_toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<include layout="#layout/toolbar" />
</android.support.design.widget.AppBarLayout>
<!--Layout-->
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!--FAB-->
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="#dimen/dp_16"
app:fabSize="normal"
app:layout_anchor="parent"
app:layout_anchorGravity="bottom|end"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="#drawable/icon_add" />
</android.support.constraint.ConstraintLayout>
It is easy to do in a constraint layout, all you have to do is hook up both vertical constraints of the fab to the end of the top image, this will center it on the line:
With CoordinatorLayout you can interact with different child views, like Snackbar and FAB can interact to move accordingly.
You can't achieve that with ConstraintLayout
Further Details: CoordinatorLayout | Android Developers
Try with Co-ordinator layout instead it is similar to constraint and easy to handle
And you can wrap your elements into coordinator layout which will solve your problem and will also provide additional functionality to the code.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fillViewport="true"
>
<!--android:background="#drawable/libertybro340x240"-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#fff"
>
<!--android:background="#color/transparent_background"-->
<include
layout="#layout/actvity_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="4dp"
android:paddingRight="3dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
>
<TextView
style="#style/small_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/case_number"
android:singleLine="true"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"/>
<TextView
style="#style/small_title_text"
android:id="#+id/display_casenum_Txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/case_number"
android:text="26/11"
android:singleLine="true"
android:layout_weight="1"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/colorPrimaryDark"
android:layout_marginTop="5dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/clientVoppo"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
>
<TextView
style="#style/small_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/client_name"
android:singleLine="true"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"/>
<TextView
style="#style/small_title_text"
android:id="#+id/display_client_Txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/client_name"
android:text="Kaware Patil"
android:layout_weight="1"
/>
</LinearLayout>
<TextView
style="#style/small_title_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="VS"
android:layout_gravity="center_horizontal"
android:singleLine="true"
android:editable="false"
android:textStyle="bold"
android:textColor="#color/colorPrimaryDark"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
>
<TextView
style="#style/small_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Opposition"
android:singleLine="true"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"/>
<TextView
style="#style/small_title_text"
android:id="#+id/display_opposition_Txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/opposition_name"
android:text="Mumbai High Court"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/colorPrimaryDark"
android:layout_marginTop="5dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
>
<TextView
style="#style/small_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/ipc_act"
android:singleLine="true"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"/>
<TextView
style="#style/small_title_text"
android:id="#+id/display_ipc_Txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/ipc_act"
android:text="420"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
>
<TextView
style="#style/small_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/advocate_name"
android:singleLine="true"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"/>
<TextView
style="#style/small_title_text"
android:id="#+id/display_advocate_Txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/advocate_name"
android:text="Prasad Gunjal"
android:singleLine="true"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
>
<TextView
style="#style/small_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/on_behalf"
android:singleLine="true"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"/>
<TextView
style="#style/small_title_text"
android:id="#+id/display_onBehalf_Txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/on_behalf"
android:text="Complainant"
android:singleLine="true"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
>
<TextView
style="#style/small_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/casecourt_name"
android:singleLine="true"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"/>
<TextView
style="#style/small_title_text"
android:id="#+id/display_court_Txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/casecourt_name"
android:text="Bombay high Court"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
>
<TextView
style="#style/small_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/case_status"
android:singleLine="true"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"/>
<TextView
style="#style/small_title_text"
android:id="#+id/display_casestat_Txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/case_status"
android:text="On Hold"
android:singleLine="true"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
>
<TextView
style="#style/small_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/case_filing_date"
android:singleLine="true"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"/>
<TextView
style="#style/small_title_text"
android:id="#+id/display_casefiling_Txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/case_filing_date"
android:text="26/11/2011"
android:singleLine="true"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
>
<TextView
style="#style/small_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/number_of_people"
android:singleLine="true"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"/>
<TextView
style="#style/small_title_text"
android:id="#+id/display_peoplenumer_Txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/number_of_people"
android:text="2"
android:singleLine="true"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
>
<TextView
style="#style/small_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Next Hearing"
android:singleLine="true"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"/>
<TextView
style="#style/small_title_text"
android:id="#+id/display_nextdateNtime_Txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/next_hearing_date"
android:text="11/11/11 10:00 AM"
android:singleLine="true"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
>
<TextView
style="#style/small_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/next_hearing_details"
android:singleLine="true"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"
/>
<TextView
style="#style/small_title_text"
android:id="#+id/display_nextdetails_Txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/next_hearing_details"
android:text="Jury on bench"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab_caseinfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_gravity="end|bottom"
android:layout_marginRight="#dimen/fab_margin"
android:layout_marginBottom="#dimen/fab_margin"
android:padding="5dp"
android:src="#android:drawable/ic_menu_edit" />
</android.support.design.widget.CoordinatorLayout>
How can i create this Layout in android studio? I try to write some codes but i can' t complete that. Thank you for helps. Should i use LinearLayout or RelativeLayout or TableLayout for same viewing for all devices.
http://i.imgur.com/EBd3CAo.png
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1"
android:background="#404040">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="59dp"
android:orientation="horizontal"
android:weightSum="1">
<EditText
android:layout_width="198dp"
android:id="#+id/editText"
android:layout_above="#+id/tv1"
android:layout_marginBottom="31dp"
android:text="12345678901"
android:autoText="false"
android:elegantTextHeight="false"
android:maxLength="11"
android:singleLine="true"
android:background="#000000"
android:textColor="#a0a0a0"
android:inputType="number"
android:textSize="40dp"
android:textAlignment="center"
android:textStyle="bold"
android:layout_height="50dp"
android:layout_weight="0.45" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="tv1"
android:id="#+id/tv1"
android:layout_weight="0.36"
android:textColor="#55ff1c"
android:paddingLeft="10dp" />
</LinearLayout>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="bla bla bla bla bla"
android:id="#+id/cbx1"
android:checked="false"
android:singleLine="true"
android:textSize="18dp" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:id="#+id/listView" />
<LinearLayout
android:orientation="vertical"
android:layout_width="180dp"
android:layout_height="wrap_content">
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"></RadioGroup>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Change margin/padding/fontsize/color as required
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#404040"
android:orientation="vertical"
android:weightSum="3">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_above="#+id/tv1"
android:autoText="false"
android:background="#000000"
android:elegantTextHeight="false"
android:inputType="number"
android:maxLength="11"
android:singleLine="true"
android:text="12345678901"
android:textAlignment="center"
android:textColor="#a0a0a0"
android:textSize="40dp"
android:textStyle="bold" />
<TextView
android:id="#+id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="tv1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#55ff1c" />
</LinearLayout>
<CheckBox
android:id="#+id/cbx1"
android:layout_margin="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:singleLine="true"
android:text="bla bla bla bla bla"
android:textSize="18dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="2.8"
android:layout_margin="10dp"
android:layout_height="0dp"
android:orientation="horizontal">
<ListView
android:id="#+id/listView"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="RadioButton1"/>
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="RadioButton2"/>
</RadioGroup>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="20sp"
android:text="Text View" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="20sp"
android:text="Text View" />
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:padding="5dp"
android:text="button" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_weight="0.2"
android:layout_margin="10dp"
android:layout_height="wrap_content"
android:text="Bottomtextview"/>
</LinearLayout>
I made a design as you need. But you may need to set height and width by your own. take a look to the below code.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:hint="Edit Text" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Text View" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Check Box" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<ListView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Radio Button" />
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Radio Button" />
</RadioGroup>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Text View"
android:textSize="24sp" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:text="Text View" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="10dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:textSize="24sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Text View"
android:textSize="30sp" />
</LinearLayout>
</LinearLayout>
I designed this by linear layout. hope it helps you.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00b9e8"
android:orientation="vertical" >
<!-- <include layout="#layout/header" /> -->
<LinearLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="#ffffff"
android:gravity="center"
android:padding="5dp" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Search Status"
android:textColor="#0060a4"
android:textSize="#dimen/font_15dp" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<ImageView
android:id="#+id/setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/settings" />
<ImageView
android:id="#+id/searchstatus_imgBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/back_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="40dp" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.35"
android:background="#drawable/round_bg"
android:padding="10dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Status"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#0060a4"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_weight="0.65"
android:background="#drawable/round_bg"
android:gravity="center"
android:padding="8dp" >
<TextView
android:id="#+id/status"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:gravity="center"
android:text="Accepted"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#0060a4"
android:textSize="20dp" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="40dip"
android:layout_height="40dip"
android:paddingLeft="25dip" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="40dp" >
<LinearLayout
android:id="#+id/linearlayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.35"
android:background="#drawable/round_bg"
android:padding="10dp" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Reason"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#0060a4"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearlayout2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_weight="0.65"
android:background="#drawable/round_bg"
android:gravity="center"
android:padding="10dp" >
<TextView
android:id="#+id/reason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#0060a4"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
</LinearLayot>
This is my code i want to add one Footer but i am unable to do this i dont know why this Problem is coming even i have take relative layout then also its not working please tell me how add one footer plz Help
Try this method and better to use relative layout for this.
<?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">
<LinearLayout
android:layout_alignParentTop="true"
android:layout_above="#+id/footer"
android:id="#+id/content"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#999"
android:layout_margin="4dp"
>
<TextView
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Content"
android:gravity="center"
android:padding="20dp"
android:textColor="#fff"
/>
</LinearLayout>
<LinearLayout
android:layout_alignParentBottom="true"
android:id="#+id/footer"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="FOOTER"
android:gravity="center"
android:padding="20dp"
android:textColor="#fff"
android:background="#666"
/>
</LinearLayout>
</RelativeLayout>
this will give like this .is that you want ?
My images. such as
when i write something then show image like
But i want write something and show that also.
My Codes :
<?xml version="1.0" encoding="utf-8"?>
<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:background="#ffffff" >
<!-- Header aligned to top -->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<include
android:id="#+id/header"
layout="#layout/header" >
</include>
<!-- Footer aligned to bottom -->
<!-- Content below header and above footer -->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="#+id/content"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="#+id/locationLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="UbicaciĆ³n"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/locationSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="#+id/deprtmentLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/locationLayout"
android:layout_marginTop="10dp"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Departamento"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/departmentSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="#+id/folderpathLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/deprtmentLayout"
android:layout_marginTop="10dp"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Carpeta"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/folderSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="#+id/locatioRnLayoutT"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/folderpathLayout"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="center|end"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="comentario"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/etComments"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="top|left"
android:hint="escribir comentario aquĆ"
android:inputType="textMultiLine"
android:lines="8"
android:maxLines="10"
android:minLines="4"
android:scrollbars="vertical" >
<requestFocus />
</EditText>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#0c95d4" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:gravity="center" >
<ImageView
android:id="#+id/backImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/img_selector"
android:clickable="true"
android:onClick="doActions"
android:src="#drawable/back_black" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1" />
<ImageView
android:id="#+id/reportOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/img_selector"
android:clickable="true"
android:onClick="doActions"
android:src="#drawable/right_button_white" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/img_selector"
android:clickable="true"
android:onClick="doActions" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
And header.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="50dp"
android:layout_alignParentTop="true"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="5" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<TextView
android:id="#+id/tvHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/layout"
android:layout_weight="4"
android:paddingLeft="8dp"
android:text="Fixed Header"
android:textColor="#33b5e5"
android:textSize="12sp" />
<RelativeLayout
android:id="#+id/layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" >
<ImageView
android:id="#+id/iHome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:background="#drawable/img_selector"
android:clickable="true"
android:onClick="goToHome"
android:src="#drawable/home_black" />
<ImageView
android:id="#+id/ilogout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#+id/iHome"
android:background="#drawable/img_selector"
android:clickable="true"
android:onClick="logoutAction"
android:paddingRight="8dp"
android:src="#drawable/logout_black" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<View
android:layout_width="match_parent"
android:layout_height="3dip"
android:background="#33b5e5" />
</LinearLayout>
</RelativeLayout>
when i write something on comment field then show pop-up windows for writing input then i don't show any text what i do write on EditText. How to show input field when i write some thing. please help me.
Set appropriate windowSoftInputMode for your activity in the manifest. adjustPan is probably what you're looking for there.
when i press on the edit text the layout become re-size. What i want is not to change the layout size when i press on the keyboard
I tried
android:windowSoftInputMode="stateVisible|adjustPan"
Refer from below link
http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft
Don't make any difference
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#bbbbbb"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".1"
android:background="#0486CC" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight=".34"
android:src="#drawable/logo" />
<TextView
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight=".32" />
<Button
android:id="#+id/button1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".16"
android:background="#drawable/newmenu"
android:onClick="MenuStaffBtnClick" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".18"
android:background="#drawable/menu_sync"
android:onClick="MenuSynBtnClick" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".2" >
<EditText
android:id="#+id/etNamecheck"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_weight=".6"
android:ems="10"
android:hint="Name" />
<RadioGroup
android:id="#+id/rgSearch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight=".4"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/rbID"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<RadioButton
android:id="#+id/rbName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="vertical" >
<ListView
android:id="#+id/LVitems"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#bbbbbb"
android:dividerHeight="5dp" >
</ListView>
</LinearLayout>
try this layout code and add android:windowSoftInputMode="stateVisible|adjustPan" in android manifest file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ScrollView
android:id="#+id/scrolllayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="#+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:orientation="vertical"
android:layout_gravity="center_vertical"
android:gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SignIn"
android:textColor="#000000"
android:layout_marginTop="10dp"
android:textSize="20dp"
/>
<EditText
android:id="#+id/userid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#000000"
android:hint="type username" />
<EditText
android:id="#+id/passwordid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="type password"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#000000"
android:inputType="textPassword" />
<Button
android:id="#+id/loginid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/list_item_title"
android:text="Signin"
android:textSize="20dp"
android:background="#drawable/btngradient"
/>
<Button android:id="#+id/registerid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dip"
android:textSize="20dp"
android:text=" Register"
android:gravity="center"
android:background="#drawable/btngradient"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp"
android:textColor="#FFFFFF"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>