Posts

Showing posts from July, 2015

Using Button Selectors in Android

If you do somethings in Buttons like background changing, stroke color means, Just follow up the xml.


Button_Selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/btn_pressed_bg" />
    <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/btn_pressed_bg" />
    <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/btn_pressed_bg" />
    <item android:state_enabled="false" android:drawable="@drawable/btn_disabled"></item>
    <item android:drawable="@drawable/btn_normal_bg" />
</selector>

btn_pressed.xml
<?xml version="1.0" encoding=&q…

Show the Ad in ListView Footer

In ListView, If you want to show your Ad(Advertisement) on Footer view.

Just Add this lines in your code:

View footerView = ((LayoutInflater) getActivity().getSystemService( Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.ads_banner_layout, null, false); WebView webView = (WebView) footerView.findViewById(R.id.ads_view); listview.addFooterView(footerView);
listview.setAdapter(adapter);
footerView is the view to inflate the ad_banner layout into your listview.
Myself I'm using the webview to show the add, but its your choice to add some kind of different layouts and widgets in your footerview.