Im using Caldroid library. I want to use it inside my layout. My layout also includes textview. But when I use Caldroid with framelayout the other views disappear.
Here is XML and Java codes using Caldroid with FrameLayout.
<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"
tools:context="com.birfincankafein.mpandroidchart.CalendarFragment"
android:orientation="vertical">
<!-- TODO: Update blank fragment layout -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:id="@+id/container_caldroid"
android:layout_weight="0.4">
</FrameLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/imageView_divider"
android:layout_below="@+id/container_caldroid"
android:focusableInTouchMode="false"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:layout_weight="0.1"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/imageView_divider"
android:background="#ffff00ba"
android:layout_weight="0.4">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView_description"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="#ff00ebff"/>
</RelativeLayout>
Here is java code:
mCaldroidFragment = new CaldroidFragment();
Bundle args = new Bundle();
args.putInt( CaldroidFragment.START_DAY_OF_WEEK, CaldroidFragment.MONDAY );
mCaldroidFragment.setArguments( args );
getActivity().getSupportFragmentManager().beginTransaction().replace( R.id.container_calendar , mCaldroidFragment ).commit();
And here what it looks like:
These are codes for using Caldroid with fragment.
<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"
tools:context="com.birfincankafein.mpandroidchart.CalendarFragment"
android:orientation="vertical">
<!-- TODO: Update blank fragment layout -->
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
class="com.roomorama.caldroid.CaldroidFragment"
android:id="@+id/container_caldroid"
android:layout_weight="0.4">
</fragment>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/imageView_divider"
android:layout_below="@+id/container_caldroid"
android:focusableInTouchMode="false"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:layout_weight="0.1"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/imageView_divider"
android:background="#ffff00ba"
android:layout_weight="0.4">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView_description"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="#ff00ebff"/>
</RelativeLayout>
And there is no need to java code. It had been initialized. Here is how it looks:
Why this happens? I want to use this library inside the frame layout. Because I have to initialize it manually. I have to set something neccassary.
Ps: The background color is for detect where the layout is.