android - Using Clock-Widget in a Fragment possible? -
i have fragment in mainactivity, displays digital clock. works: shows current system time. looks rather simple. before start trying style clock wanted ask, if there way, use systems digital-clock widget?
screenshot of widget, i'd use in fragment:
fragmentclock.java:
public class fragmentclock extends fragment { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { super.oncreate(savedinstancestate); view view = inflater.inflate(r.layout.fragment_clock, container, false); return view; } }
fragment_clock.xml:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayoutclockdisplay" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#000000"> <digitalclock android:id="@+id/digital_clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="visible"/> </linearlayout>
Comments
Post a Comment