java - issue using HorizontalPicker library -
i implemented this library app accomplishing horizontal picker view think followed whatever asked dont know why nit showing (widget here totally transparent) how implemented :
mainactivity:
public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); floatingactionbutton fab = (floatingactionbutton) findviewbyid(r.id.fab); fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { snackbar.make(view, "replace own action", snackbar.length_long) .setaction("action", null).show(); } }); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_main, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } }
main.xml:
<?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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="pb.monthpicker.mainactivity" tools:showin="@layout/activity_main"> <com.wefika.horizontalpicker.horizontalpicker xmlns:picker="http://schemas.android.com/apk/lib/com.wefika.horizontalpicker" android:layout_width="match_parent" android:layout_height="match_parent" android:textcolor="@color/colorprimarydark" android:textsize="@dimen/textsize" android:ellipsize="start" android:marqueerepeatlimit="-1" android:id="@+id/month_picker" picker:values="@array/values" picker:dividersize="@dimen/itempadding" picker:sideitems="@integer/sideitems" android:layout_centervertical="true" android:layout_centerhorizontal="true" /> </relativelayout>
this values:
// value of sideitems `<integer name="sideitems">3</integer>` // value of text size: <dimen name="textsize">16dp</dimen> //value of padding: <dimen name="itempadding">8dp</dimen> // value of array <string-array name="values"> <item>1</item> <item>2</item> <item>3</item> <item>4</item> <item>5</item> <item>6</item> <item>7</item> <item>8</item> <item>9</item> <item>10</item> </string-array>
// build.grade
apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "23.0.2" defaultconfig { applicationid "pb.monthpicker" minsdkversion 16 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1' compile 'com.wefika:horizontal-picker:+' }
guys idea doing wrong ? guidance helpful me , :)
replace in gradle file
compile 'com.wefika:horizontal-picker:+
with
compile 'com.wefika:horizontal-picker:1.1.0'
try layout :
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.wefika.horizontalpicker.example.mainactivity"> <com.wefika.horizontalpicker.horizontalpicker android:id="@+id/picker" android:layout_width="match_parent" android:layout_height="wrap_content" android:textcolor="@android:color/holo_blue_dark" android:textsize="22sp" android:paddingtop="16dp" android:paddingbottom="16dp" android:ellipsize="marquee" android:marqueerepeatlimit="2" android:focusable="true" android:focusableintouchmode="true" app:values="@array/values" app:dividersize="10dp" app:sideitems="1"/> </relativelayout>
Comments
Post a Comment