2

I wrote xml like this but how to call this in main acivity like that need to show the card view after the list view.In my main activity welcome post is not visible. I need to show that layout at the end of my list view which is fetching from my data base

  <android.support.v4.widget.SwipeRefreshLayout 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:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="match_parent">

<RelativeLayout 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"
    tools:context="com.shuan.Project.fragment.ConnectionFragment">


     <ProgressBar
        android:id="@+id/progress_bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />

    <ListView
        android:id="@+id/post"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:divider="@null"
        android:visibility="gone" />

    <RelativeLayout
        android:layout_below="@+id/post"
        android:id="@+id/udyopro_post"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="gone">
    <android.support.v7.widget.CardView
        android:id="@+id/udyopost"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/standard_margin"
        android:layout_marginLeft="@dimen/standard_margin"
        android:layout_marginRight="@dimen/standard_margin"
        android:layout_marginTop="28dp"
        app:cardBackgroundColor="#f0f0f0"
        app:cardCornerRadius="@dimen/small_margin"
        app:cardElevation="@dimen/small_margin">
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
        <ImageView
            android:id="@+id/cmpny_logo"
            android:layout_width="45dp"
            android:layout_height="45dp"
            android:layout_marginBottom="@dimen/small_margin"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:layout_marginTop="@dimen/standard_margin"
            android:background="@drawable/job_post"
            android:elevation="@dimen/standard_margin"
            android:padding="2dp"
            android:src="@drawable/logo" />
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/cmpny_logo"
                android:textAppearance="?android:textAppearanceLarge"
                android:text="Welcome to Udyomitra..!"
                android:paddingTop="16dp"
                android:paddingLeft="10dp"
                android:textStyle="bold"/>
        <TextView
            android:id="@+id/prof"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/cmpny_logo"
            android:padding="@dimen/standard_margin"
            android:textAppearance="?android:textAppearanceMedium"
            android:text="             Greetings of the day!! Welcome to a whole new world of opportunities. With the New Year ahead of us, Udyomitra will help you write a new story by setting higher goals in your life. We exposed you to all the vacancies in and around your native location by default. You will be following all your college mates and their working firms by default. We generate a decent quality resume for you for free. We will help you find the work you enjoy since you are best suited for it.We wish you all success!"/>
        </RelativeLayout>
    </android.support.v7.widget.CardView>
        </RelativeLayout>
  </RelativeLayout>
 </android.support.v4.widget.SwipeRefreshLayout>

This is my xml file

Error after replacing code suggested by "@patel pinkal"

   01-25 12:06:56.701 19657-19657/com.shuan.Project E/AndroidRuntime: FATAL EXCEPTION: main
                                                               Process: com.shuan.Project, PID: 19657
                                                               java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout
                                                                   at android.widget.RelativeLayout$DependencyGraph.getSortedViews(RelativeLayout.java:1895)
                                                                   at android.widget.RelativeLayout.sortChildren(RelativeLayout.java:401)
                                                                   at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:409)
                                                                   at android.view.View.measure(View.java:17915)
                                                                   at android.support.v4.widget.SwipeRefreshLayout.onMeasure(SwipeRefreshLayout.java:612)
                                                                   at android.view.View.measure(View.java:17915)
                                                                   at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:846)
                                                                   at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:512)
                                                                   at android.view.View.measure(View.java:17915)
                                                                   at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:846)
                                                                   at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:512)
                                                                   at android.view.View.measure(View.java:17915)
                                                                   at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1075)
                                                                   at android.view.View.measure(View.java:17915)
                                                                   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
                                                                   at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
                                                                   at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
                                                                   at android.view.View.measure(View.java:17915)
                                                                   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
                                                                   at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1692)
                                                                   at android.widget.LinearLayout.measureVertical(LinearLayout.java:760)
                                                                   at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
                                                                   at android.view.View.measure(View.java:17915)
                                                                   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
                                                                   at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
                                                                   at android.view.View.measure(View.java:17915)
                                                                   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
                                                                   at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1692)
                                                                   at android.widget.LinearLayout.measureVertical(LinearLayout.java:760)
                                                                   at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
                                                                   at android.view.View.measure(View.java:17915)
                                                                   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
                                                                   at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
                                                                   at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2730)
                                                                   at android.view.View.measure(View.java:17915)
                                                                   at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2412)
                                                                   at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1414)
                                                                   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1638)
                                                                   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1292)
                                                                   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6598)
                                                                   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800)
                                                                   at android.view.Choreographer.doCallbacks(Choreographer.java:603)
                                                                   at android.view.Choreographer.doFrame(Choreographer.java:572)
                                                                   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)
                                                                   at android.os.Handler.handleCallback(Handler.java:815)
                                                                   at android.os.Handler.dispatchMessage(Handler.java:104)
                                                                   at android.os.Looper.loop(Looper.java:194)
                                                                   at android.app.ActivityThread.main(ActivityThread.java:5649)
                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                   at java.lang.reflect.Method.invoke(Method.java:372)
                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
Nazim ch
  • 834
  • 8
  • 20

2 Answers2

0

You can use scrollView

<ScrollView
  android:layout_width="match_parent"
  android:layout_height="match_parent">
    // layout content
</ScrollView>

for further details refer this link

Hope this helps.

kaido
  • 314
  • 1
  • 13
0

Replace this

<ListView
    android:id="@+id/post"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:divider="@null"   
    android:visibility="gone" />

With

<ListView
    android:id="@+id/post"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:divider="@null"
    android:layout_above="@+id/udyopro_post"      
    android:visibility="gone" />

also replace this

<RelativeLayout
    android:layout_below="@+id/post"
    android:id="@+id/udyopro_post"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone">

with this

<RelativeLayout
    android:layout_alignParentBottom="true"
    android:id="@+id/udyopro_post"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone">
Patel Pinkal
  • 8,984
  • 4
  • 28
  • 50