Added empty list view in ForecastFragment
This commit is contained in:
@@ -139,6 +139,8 @@ public class ForecastFragment extends Fragment implements LoaderManager.LoaderCa
|
||||
|
||||
// Get a reference to the ListView, and attach this adapter to it.
|
||||
mListView = (ListView) rootView.findViewById(R.id.listview_forecast);
|
||||
View emptyView = rootView.findViewById(R.id.listview_forecast_empty);
|
||||
mListView.setEmptyView(emptyView);
|
||||
mListView.setAdapter(mForecastAdapter);
|
||||
// We'll call our MainActivity
|
||||
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
|
||||
@@ -24,4 +24,16 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="@null" />
|
||||
<!-- empty list -->
|
||||
<TextView
|
||||
android:id="@+id/listview_forecast_empty"
|
||||
android:text="@string/empty_forecast_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
@@ -109,4 +109,7 @@
|
||||
<!-- Strings related to Notification preference -->
|
||||
<string name="pref_last_notification">last_notification</string>
|
||||
|
||||
<!-- Empty Weather Database -->
|
||||
<string name="empty_forecast_list">No Weather Information Available</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user