This is my xml infected code..
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#331c57"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_centerVertical="true"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="#drawable/gappshapp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="50dp"
android:layout_height="60dp"
android:layout_alignParentRight="true"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="#drawable/threedots" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Activation"
android:textColor="#android:color/background_dark"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="25dp"
android:background="#331c57"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="An Activation Code was Sent to your Mobile Device, Enter the code below"
android:textColor="#android:color/background_light"
android:textSize="15sp" />
</LinearLayout>
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="250210"
android:textColor="#android:color/background_dark" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="25dp"
android:orientation="horizontal" >
<CheckBox
android:id="#+id/chkIos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="I agree with the Terms and Conditions" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/continuebtn" />
</LinearLayout>
</LinearLayout>
it crashes when i changes my theme
i also uses the appcompat-v7 as a library and android support v7 appcompat and android support v4 jar as library but still it crash
this is my xml code,there is not code in activity,i just working on xml file and and it crashes at checkbox
during inflating class android widget checkbox...
i don't know whats happening here, i need solution for it.
I had the same problem today.
If I use the following:
import android.support.v7.app.AppCompatActivity;
and try and use import android.widget.CheckBox;
with a standard checkbox:
private CheckBox mSendSMSNotification;it also fails with the same error.
Converting to:
import android.support.v7.widget.AppCompatCheckBox;
private AppCompatCheckBox mSendSMSNotification;
and also in XML:
<android.support.v7.widget.AppCompatCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Send SMS Notification when Reports Emailed"
android:id="#+id/checkBoxSendSMSNotification"
android:layout_row="3"
android:layout_column="0"
android:layout_columnSpan="2" />
resolves the error, but I dont know why.
My min API 16, target API 23
Related
Every time I work with the emulator the app is fine, but when I send it to its sides it always turns upside down and everything on the right goes to the left and everything on the left goes to the right. can you please try to help me figure out what do I need to do in order to make this stop, so the app in my phone will be like the emulator?
example:
the activity in my phone
Example:
the activity in the emulator
here is the xml code
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
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="settings"
android:textColor="#0000FF"
android:textSize="50dp"
android:textAlignment="center"
android:textStyle="italic"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="choose your level"
android:textColor="#3300FF"
android:textSize="30dp"
android:textStyle="bold"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<RadioButton
android:id="#+id/begginer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="begginer"
android:textSize="30dp"
/>
<RadioButton
android:id="#+id/pro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="professional"
android:textSize="30dp" />
<RadioButton
android:id="#+id/WorldClass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="WorldClass"
android:textSize="30dp" />
<RadioButton
android:id="#+id/Legendery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Legendery"
android:textSize="30dp" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="enter your name"
android:textColor="#3300FF"
android:textSize="27dp"
android:textStyle="bold"
android:layout_weight="1"
/>
<EditText
android:textSize="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="#+id/nameid"
android:textColor="#FFFFFF"
/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:scaleType="centerCrop"
android:src="#drawable/tetrisstartgamebutton"
android:onClick="start"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:gravity="right|bottom"
android:orientation="vertical" >
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:onClick="menu"
android:layout_marginBottom="20dp"
android:layout_marginRight="40dp"
android:scaleType="centerCrop"
android:src="#drawable/aaaaaa"
android:id="#+id/BackToTheMenu"/>
</LinearLayout>
One reason could be because Force RTL layout direction is enabled
So check in device if you have it as enabled (Settings > Developer Options > Force RTL layout direction) and disable it.
The cause could be related to RTL o something like that, greetings
I get this render problem when trying to view the preview or design view in some of my my xml layouts:
Exception raised during rendering: Could not initialize class libcore.util.ZoneInfoDB
Here is one of my layouts with the problem:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/rl"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="#+id/rlMeasures"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp" >
<TextView
android:id="#+id/tvBat"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/percentage"
android:textSize="20sp" />
<TextView
android:id="#+id/tvAlarm"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/tvBat"
android:layout_toRightOf="#id/tvBat"
android:layout_toEndOf="#id/tvBat"
android:gravity="end"
android:text="#string/blank"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/rlMeasures"
android:layout_centerHorizontal="true" >
<TextView
android:id="#+id/tvTime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/time"
android:textSize="80sp" />
<TextView
android:id="#+id/tvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tvTime"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="#string/date"
android:textSize="20sp" />
<TextView
android:id="#+id/tvAmPm"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/tvTime"
android:layout_marginBottom="15dp"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#id/tvTime"
android:layout_toEndOf="#id/tvTime"
android:gravity="center"
android:text="#string/ampm"
android:textSize="20sp" />
</RelativeLayout>
<AnalogClock
android:id="#+id/ac"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#+id/rlTime"
android:layout_below="#+id/adView"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:dial="#drawable/acnbface"
android:hand_hour="#drawable/achour"
android:hand_minute="#drawable/acminute" />
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-6205053969368684/3258044850"
android:gravity="center" >
</com.google.android.gms.ads.AdView>
<RelativeLayout
android:id="#+id/rlActivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:background="#drawable/gradientright"
android:gravity="center_vertical|start" >
<ScrollView
android:id="#+id/svActivity"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
tools:ignore="UselessParent" >
<RelativeLayout
android:id="#+id/rlActivity2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" >
<ImageButton
android:id="#+id/ibStopwatch"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_margin="10dp"
android:background="#drawable/stopwatch"
android:contentDescription="#string/stopwatch" />
<ImageButton
android:id="#+id/ibFs"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_below="#id/ibStopwatch"
android:layout_margin="10dp"
android:background="#drawable/fs"
android:contentDescription="#string/fs" />
<ImageButton
android:id="#+id/ibFsn"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_below="#id/ibFs"
android:layout_margin="10dp"
android:background="#drawable/fsnm"
android:contentDescription="#string/fsn" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlShort"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_gravity="center_vertical"
android:background="#drawable/gradientleft"
android:gravity="center_vertical|end" >
<ScrollView
android:id="#+id/svShort"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
tools:ignore="UselessParent" >
<RelativeLayout
android:id="#+id/rlShort2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" >
<ImageButton
android:id="#+id/ibMusic"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="5dp"
android:background="#drawable/music"
android:contentDescription="#string/music" />
<ImageButton
android:id="#+id/ibYoutube"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="#id/ibMusic"
android:layout_margin="5dp"
android:background="#drawable/youtube"
android:contentDescription="#string/youtube" />
<ImageButton
android:id="#+id/ibKeep"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="#id/ibYoutube"
android:layout_margin="5dp"
android:background="#drawable/keep"
android:contentDescription="#string/keep" />
<ImageButton
android:id="#+id/ibPlay"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="#id/ibKeep"
android:layout_margin="5dp"
android:background="#drawable/play"
android:contentDescription="#string/play" />
<ImageButton
android:id="#+id/ibSearch"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="#id/ibPlay"
android:layout_margin="5dp"
android:background="#drawable/search"
android:contentDescription="#string/search" />
<ImageButton
android:id="#+id/ibBrowser"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="#id/ibSearch"
android:layout_margin="5dp"
android:background="#drawable/browser"
android:contentDescription="#string/browser" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
I am getting no errors or warnings from Android Studio and i can debug the application without any issues. Can anyone explain to me the situation? is it something in my code or an Android Studio Bug?
Thanks
This error occurs with the AnalogClock under Android 21. You can try switching (temporarily) to Android L or lower while you work on your layout.
A report was filed for this issue at http://b.android.com/79160
Hi I am trying to achieve parallaxscrollview in my application using library from link below:-
https://github.com/nirhart/ParallaxScroll
And below is the my xml code:-
<com.nirhart.parallaxscroll.views.ParallaxScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:inner_parallax_factor="1.9"
app:parallax_factor="1.9"
app:parallax_views_num="3"
android:background="#drawable/bg_profile_summary" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/LIN_First"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false"
android:weightSum="2" >
<RelativeLayout
android:id="#+id/REL_People"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="1"
android:background="#drawable/bg_profile_list_item"
android:padding="10dp" >
<TextView
android:id="#+id/TXT_Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:textStyle="bold"
android:text="#string/str_txt_people"
android:textColor="#FFFFFF" />
<ImageView
android:id="#+id/IMG_Right_Arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="right"
android:contentDescription="#string/app_name"
android:src="#drawable/ic_nav_right_white" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/REL_Popular"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="1"
android:background="#drawable/bg_profile_list_item"
android:padding="10dp" >
<TextView
android:id="#+id/TXT_TitlePopular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:textStyle="bold"
android:text="#string/str_txt_popular"
android:textColor="#FFFFFF" />
<ImageView
android:id="#+id/IMG_Right_Arrow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="right"
android:contentDescription="#string/app_name"
android:src="#drawable/ic_nav_right_white" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:id="#+id/REL_Official_Act"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="#+id/LIN_First"
android:background="#drawable/bg_profile_list_item"
android:padding="10dp" >
<TextView
android:id="#+id/TXT_OfficialAccounts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:textStyle="bold"
android:text="#string/str_official_accounts"
android:textColor="#FFFFFF" />
<ImageView
android:id="#+id/IMG_Right_Arrow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="right"
android:contentDescription="#string/app_name"
android:src="#drawable/ic_nav_right_white" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/REL_Search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/REL_Official_Act"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<EditText
android:id="#+id/EDT_Search_text"
android:layout_width="250dp"
android:layout_height="35dp"
android:background="#drawable/ic_search_text_background"
android:hint="#string/str_edt_searchanything_hint"
android:paddingBottom="2dp"
android:paddingLeft="15dp"
android:paddingTop="2dp" />
<RelativeLayout
android:id="#+id/REL_SearchButton"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/EDT_Search_text"
android:background="#drawable/ic_search_btn_bg"
android:gravity="center" >
<Button
android:id="#+id/BTN_Search"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:background="#drawable/ic_search"
android:padding="5dp" />
</RelativeLayout>
</RelativeLayout>
<ListView
android:id="#+id/LST_AlbumList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_alignParentBottom="true"
android:layout_below="#+id/REL_Search"
android:dividerHeight="0dip" >
</ListView>
</RelativeLayout>
</com.nirhart.parallaxscroll.views.ParallaxScrollView>
I am trying to achieve MultipleParallaxScrollView.
But nothing is happening.
Will anybody please explain me what to do??
Thanks in advance.
You need to use LinearLayout as a child in ParallaxScrollView.
You should place one child in ParallaxScrollView containing the entire contents to scroll; which is a LinearLayout
this problem is occurred because dependency use implementation 'com.github.nirhart:parallaxscroll:1.0' not working with compileSdkVersion 27 or new sdk version,
you can salve this to download module from github and impot module in your project and update with ur project sdk version.this is my project update library gradle sdk version
I'm using DrawerLayout in my app.
I test it in Samsung note 3 and samsung S4 everything is fine. But when it test to Samsung S3 the layout has messed up.
Please refer to below image
Test in Samsung Note 3 and Samsung S4 :
http://www.imagesup.net/?di=1514046988962
Test in Samsung S3 :
http://www.imagesup.net/?di=14140469921515
My xml layout code as following below :
<include
android:id="#+id/shopping_cart_slider"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="end"
layout="#layout/shopping_cart_redesign"
android:choiceMode="singleChoice" />
And this is layout that included :
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/grey_register_text" >
<LinearLayout
android:id="#+id/shopping_cart_redesign_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/grey_register_text"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="#+id/info_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:orientation="vertical" >
<ImageView
android:id="#+id/logo_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:contentDescription="#string/desc_list_item_icon" />
<com.zukami.apps.dev.blynk.util.CustomListView
android:id="#+id/list_shopping_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/logo_image"
android:background="#android:color/white"
android:divider="#color/grey_register_text"
android:dividerHeight="1dp" >
</com.zukami.apps.dev.blynk.util.CustomListView>
<View
android:id="#+id/border"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/list_shopping_cart"
android:layout_marginTop="5dp"
android:background="#color/grey_register_text" />
<RelativeLayout
android:id="#+id/total_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/border"
android:layout_marginTop="10dp" >
<LinearLayout
android:id="#+id/total_text_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="2dp"
android:orientation="vertical" >
<TextView
android:id="#+id/total_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="#string/total"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/merchandise_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="#string/merchandise_total"
android:textSize="15sp" />
<TextView
android:id="#+id/loyalty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="#string/loyalty"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:orientation="vertical" >
<TextView
android:id="#+id/total_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/total_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textSize="15sp" />
</LinearLayout>
</RelativeLayout>
<View
android:id="#+id/border_two"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/total_layout"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:background="#android:color/black" />
<Button
android:id="#+id/confirm_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/border_two"
android:layout_marginBottom="2dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:background="#drawable/grey_shopping_cart_button"
android:gravity="center|center_horizontal"
android:text="#string/confirm_order"
android:textColor="#android:color/white"
android:textSize="16sp"
android:textStyle="bold" />
<View
android:id="#+id/space"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="#+id/confirm_button"
android:layout_marginTop="5dp" />
</RelativeLayout>
<ImageView
android:id="#+id/receipt_border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/info_container"
android:layout_marginTop="-6dp"
android:contentDescription="#string/icon"
android:src="#drawable/receipt_border" />
<TextView
android:id="#+id/receipt_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/receipt_border"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#android:color/white"
android:textSize="15sp" />
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleLargeInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
Kindly advise what's wrong with this layout because I have set all width to match parent but still not working in all device.
Really appreciate for any kind help.
Hmm, I cant see anything wrong right now.
One time I had a problem that anything on my code was wrong, but on devices running API 18+ the android:gravity="center_vertical" simple did not work, but I fix it just changing the value of android:target="18" to android:target="16". I choose "16" because it was the version of my Android that was running without any problems.
I don't know if this is your case, but change the android target property at Android Manifest.xml, just give it a try (y)
I want to create a Layout that have the feature of expand and collapse .Expand should be like that at a time only one row can be expanded ,if user clicks on other first should be closed by itself.In each row i have to show different layout design .
Please help me in this ,i have searched but i am not getting i how could i create this functionality .Please take this as a reference how it will be like .Please suggest me the best approach to get this
You can use a lib Accordion-View screenshot is :
I have implemented some code as the answer suggested by #Super User. So from that i think you will sure get your solution.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:accordion="http://schemas.android.com/apk/res-auto/com.sentaca.android.accordion"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#android:color/white"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/main_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#ff0000"
android:orientation="horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Offline Booking Request"
android:textColor="#fff"
android:textStyle="bold" />
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<com.sentaca.android.accordion.widget.AccordionView
android:id="#+id/accordion_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
accordion:header_layout_fold_button_id="#id/foldButton"
accordion:header_layout_id="#layout/accordion_header"
accordion:header_layout_label_id="#id/foldText"
accordion:section_bottom="#layout/accordion_footer"
accordion:section_container="#layout/accordion_section"
accordion:section_container_parent="#id/section_content"
accordion:section_headers="#array/accordion_sections"
accordion:section_visibility="#array/accordion_visibility"
android:background="#fff5f5f5"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Please specify offline car details if you need any cars of travels"
android:textSize="14sp" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="45dp"
android:text="Plase click the checkbox to send the details"
android:textColor="#ff0000" />
<include layout="#layout/radio" >
</include>
</LinearLayout>
<LinearLayout
android:id="#+id/example_get_by_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item 2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item 3" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item 4" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RatingBar
android:id="#+id/ratingBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<SeekBar
android:id="#+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item 4" />
</com.sentaca.android.accordion.widget.AccordionView>
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Review" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Confirm" />
</LinearLayout>
</LinearLayout>
Now just remember one thing whenever you want to add layout items then add item in Linear Layout and make different layout for different sections and after that include that layout in your Linear layout. I have tried for one section named radio.xml file which is included in Linear Layout above.
radio.xml
<?xml version="1.0" encoding="utf-8"?>
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/radio0"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:checked="true"
android:text="Domestic"
android:textColor="#ff0000" />
<RadioButton
android:id="#+id/radio1"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="InterNational"
android:textColor="#ff0000" />
</RadioGroup>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Pick Up Location"
android:textAppearance="?android:attr/textAppearanceSmall" />
<EditText
android:id="#+id/editText1"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_weight="1"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="DropLocation"
android:textAppearance="?android:attr/textAppearanceSmall" />
<EditText
android:id="#+id/editText2"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_weight="1"
android:ems="10" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:text="Car Type"
android:textColor="#000" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_gravity="center"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:text="Remarks"
android:textColor="#000" />
<EditText
android:id="#+id/editText3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textMultiLine" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
You can start with ExpandableListView and customize it to your need. I think this would be a good way to start. Please follow a link below to customize ExpandableListView :
http://androidexample.com/Custom_Expandable_ListView_Tutorial_-_Android_Example/index.php?view=article_discription&aid=107&aaid=129
You can google for more links on customizing expandablelistview. Hope it helps.
You can use scaleAnimation where you can add in each section a layout panel and inside the layout textview or anything as your requirement. See this. Hope it might help you.
http://wwwpriyaandroid.blogspot.in/2013/10/accordion.html