- Posts: 37
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about Android development and PDF
Add custom icons and make them work
10 years 1 month ago #11306
by jorisk
Replied by jorisk on topic Add custom icons and make them work
Here is the bar_cmd.xml file :
And here is the result:
These are the missing icons:
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
android:background="@color/pdfreaderact_toolbar_background">
<ImageView
android:id="@+id/btn_return"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_margin="2dp"
android:clickable="true"
android:icon="@drawable/btn_back" />
<ImageView
android:id="@+id/btn_summary"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/btn_return" android:layout_toEndOf="@id/btn_return"
android:layout_margin="2dp"
android:clickable="true"
android:icon="@drawable/ic_action_list_2" />
<ImageView
android:id="@+id/btn_find"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/btn_summary" android:layout_toEndOf="@id/btn_summary"
android:layout_margin="2dp"
android:clickable="true"
android:src="@drawable/ic_action_search" />
</RelativeLayout>
These are the missing icons:
10 years 1 month ago #11307
by nermeen
Replied by nermeen on topic Add custom icons and make them work
Please replace:
with:
Code:
android:icon="@drawable/ic_action_list_2"
android:icon="@drawable/btn_back"
Code:
android:src="@drawable/ic_action_list_2"
android:src="@drawable/btn_back"
10 years 1 month ago #11309
by jorisk
Replied by jorisk on topic Add custom icons and make them work
Wow, I didn't even see that... Thanks!
For the quit method, I know how and where to make the click method, but I don't know how to make it work because PDFViewAct.onDestroy() is not working from PDFLayoutView, and m_doc.Close() close the document but not the Activity.
For the quit method, I know how and where to make the click method, but I don't know how to make it work because PDFViewAct.onDestroy() is not working from PDFLayoutView, and m_doc.Close() close the document but not the Activity.
10 years 1 month ago #11310
by nermeen
Replied by nermeen on topic Add custom icons and make them work
You can do as the following;
- Create an interface in PDFViewController:
Code:public interface PDFViewControllerListener { public void OnBackClicked(); }
- Create a listener variable in PDFViewController:
Code:PDFViewControllerListener mListener;
- Pass the listener to the PDFViewController constructor and save it:
Code:public PDFViewController(RelativeLayout parent, PDFLayoutView view, PDFViewControllerListener listener) { mListener = listener;
- In the onClick of your button call the listener:
Code:mListener.OnBackClicked();
- In the PDFViewAct, pass the listener implementation:
Code:m_controller = new PDFViewController(m_layout, m_view, new PDFViewController.PDFViewControllerListener() { @Override public void OnBackClicked() { finish(); } });
Time to create page: 0.355 seconds