graph not showing in horizontalscrollview android - android

i am microcharts.droid.ChartView in xamarin to make a line graph, and i want it to be horizontal scroll able, but by using following code graph is not showing up.
<?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="match_parent"
android:background="#444444">
<refractored.controls.CircleImageView
app:civ_border_width="2dp"
app:civ_border_color="#FFFFFF"
android:layout_width="80dp"
android:layout_height="80dp"
android:id="#+id/profilepicimageview"
android:src="#drawable/profilepic"
android:scaleType="centerCrop"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp" />
<TextView
android:text="..."
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_below="#id/profilepicimageview"
android:textColor="#android:color/white"
android:id="#+id/txtHomeFullName"
android:layout_marginLeft="5dp" />
<TextView
android:text="12500"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/HomeUserTextViewScore"
android:textColor="#android:color/white"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="30dp"
android:layout_marginRight="60dp" />
<ImageView
android:src="#drawable/star"
android:layout_width="30dp"
android:layout_height="30dp"
android:id="#+id/imageViewStarHome"
android:scaleType="centerCrop"
android:layout_marginTop="30dp"
android:layout_toLeftOf="#id/HomeUserTextViewScore" />
<ProgressBar
style="#android:style/Widget.ProgressBar.Horizontal"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:maxHeight="15dp"
android:minHeight="15dp"
android:layout_below="#id/imageViewStarHome"
android:id="#+id/progressBarHome"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:layout_marginRight="30dp" />
<HorizontalScrollView
android:id="#+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="80dp">
<TextView
android:text="WELCOME TO PERKIT"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:background="#302f2f"
android:textColor="#android:color/white"
android:id="#+id/textViewWelcomeToPerkit" />
<microcharts.droid.ChartView
android:id="#+id/chartView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</HorizontalScrollView>
<LinearLayout
android:id="#+id/linebtn"
android:layout_height="55dp"
android:layout_width="match_parent"
android:background="#444444"
android:layout_alignParentBottom="true"
android:gravity="center"
android:orientation="horizontal">
<ImageButton
android:src="#drawable/rewardDisabled"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginRight="16dp"
android:background="#drawable/roundedbutton"
android:id="#+id/btnHomeReward" />
<ImageButton
android:src="#drawable/leaderDisabled"
android:id="#+id/btnHomeTournaments"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginRight="8dp"
android:background="#drawable/roundedbutton" />
<ImageButton
android:src="#drawable/settingsDisabled"
android:id="#+id/btnHomeSettings"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginLeft="8dp"
android:background="#drawable/roundedbutton" />
<ImageButton
android:src="#drawable/homeEnabled"
android:id="#+id/btnHomeHome"
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_marginLeft="16dp"
android:background="#drawable/roundedbuttonEnabled" />
</LinearLayout>
<TextView
android:text="Loading.."
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#android:color/white"
android:id="#+id/txtLoadingTextHome"
android:gravity="center"
android:background="#8889" />
</RelativeLayout>
i want to make the graph horizontal scroll able. to show on layout.
thanks. how can i achieve it in android.i am developing the app in xamarin android. is there any other good library to achieve this?

Try to specify a fixed layout_width to the chartView

Related

Scrollview under the header

Is there a way to do this in android studio? I want to achieve that when you scroll down the header will overlap above and under is the scrollview part. What I've got is it scrolls over the header. In android studio
This is what Im trying to achieve that was made in figma
Default
When you scroll
So far this is what my code looks like
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".Fragment.RecordFragment"
android:orientation="vertical">
<View
android:layout_width="369dp"
android:layout_height="71dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="13dp"
android:layout_alignParentTop="true"
android:layout_marginTop="14dp"
android:background="#drawable/ic_header"/>
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="25dp"
android:layout_marginTop="25dp"
android:layout_marginEnd="25dp"
android:layout_marginBottom="25dp"
android:text="Record"
android:textAlignment="center"
android:textColor="#color/white"
android:textSize="35sp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="100dp">
<TextView
android:id="#+id/txtDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="128dp"
android:text="Date for today"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="50sp" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<View
android:layout_width="316dp"
android:layout_height="201dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_gravity="center"
android:layout_marginTop="50dp"
android:background="#drawable/sec_bp" />
<EditText
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="70dp"
android:background="#drawable/rounded_corner"
android:gravity="center"
android:hint="SBP" />
<EditText
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="120dp"
android:background="#drawable/rounded_corner"
android:gravity="center"
android:hint="DBP" />
<EditText
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="170dp"
android:background="#drawable/rounded_corner"
android:gravity="center"
android:hint="BPM" />
<Button
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_marginLeft="120dp"
android:layout_marginTop="210dp"
android:background="#drawable/rounded_corner"
android:gravity="center"
android:text="save" />
</RelativeLayout>
<View
android:layout_width="316dp"
android:layout_height="117dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="50dp"
android:background="#drawable/sec_temp" />
<View
android:layout_width="316dp"
android:layout_height="117dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="50dp"
android:background="#drawable/sec_temp" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
Try adding elevation inside your header view. like this :
<View
android:layout_width="369dp"
android:layout_height="71dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="13dp"
android:layout_alignParentTop="true"
android:layout_marginTop="14dp"
android:background="#drawable/ic_header"/
android:elevation="1dp">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="25dp"
android:layout_marginTop="25dp"
android:layout_marginEnd="25dp"
android:layout_marginBottom="25dp"
android:text="Record"
android:textAlignment="center"
android:textColor="#color/white"
android:textSize="35sp"
android:elevation="2dp"/>
I set the View elevation 1dp and the TextView 2dp so that the text can still in front of the View.

I do not see the same in Emulator, according to Android Studio's preview or Android phone

I am learning from Udacity, I have learned so far LinearLayout and RelativeLayout. Based on this I tried to create an xml for a project. I created it according to preview from inside Android Studio Nexus 5X. Then when I run this in Emulator Nexus 5X again I see different output the project was created according to API 15. Then when I run it on my Android phone I see it as on preview. Following I will post the outcomes:
<?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"
tools:context=".MainActivity">
<ImageView
android:id="#+id/background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
app:srcCompat="#drawable/background" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/topScore"
android:layout_width="350dp"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_marginBottom="15dp"
android:layout_weight="5">
<ImageView
android:id="#+id/topImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="#drawable/topscore" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="18dp"
android:gravity="center"
android:text="0 - 0"
android:textColor="#android:color/background_light"
android:textSize="26dp" />
<ImageButton
android:id="#+id/arrowRightScore"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="30dp"
android:layout_marginRight="6dp"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<ImageButton
android:id="#+id/arrowLeftScore"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginLeft="6dp"
android:layout_marginTop="30dp"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
</RelativeLayout>
<RelativeLayout
android:layout_width="390dp"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_marginBottom="25dp"
android:layout_weight="1">
<ImageView
android:id="#+id/row1"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="#drawable/row" />
<TextView
android:id="#+id/textRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/row1"
android:layout_alignTop="#id/row1"
android:layout_alignRight="#id/row1"
android:layout_alignBottom="#id/row1"
android:layout_margin="1dp"
android:gravity="center"
android:text="SHOTS"
android:textColor="#000000"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowLeftRow1"
android:layout_width="52dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row1"
android:layout_alignRight="#+id/arrowLeftRow1"
android:layout_alignBottom="#id/row1"
android:layout_marginTop="0dp"
android:layout_marginRight="-35dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowRightRow1"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row1"
android:layout_alignBottom="#id/row1"
android:layout_alignParentRight="true"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/arrowRightRow1"
android:layout_alignTop="#id/row1"
android:layout_alignBottom="#id/row1"
android:layout_marginLeft="-45dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="390dp"
android:layout_height="0dp"
android:layout_marginBottom="25dp"
android:layout_weight="1">
<ImageView
android:id="#+id/row2"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="#drawable/row" />
<TextView
android:id="#+id/textRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/row2"
android:layout_alignTop="#id/row2"
android:layout_alignRight="#id/row2"
android:layout_alignBottom="#id/row2"
android:layout_margin="1dp"
android:gravity="center"
android:text="FOULS"
android:textColor="#000000"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowLeftRow2"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row2"
android:layout_alignBottom="#id/row2"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row2"
android:layout_alignRight="#+id/arrowLeftRow2"
android:layout_alignBottom="#id/row2"
android:layout_marginTop="0dp"
android:layout_marginRight="-45dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowRightRow2"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row2"
android:layout_alignBottom="#id/row2"
android:layout_alignParentRight="true"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/arrowRightRow2"
android:layout_alignTop="#id/row2"
android:layout_alignBottom="#id/row2"
android:layout_marginLeft="-45dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="390dp"
android:layout_height="0dp"
android:layout_marginBottom="25dp"
android:layout_weight="1">
<ImageView
android:id="#+id/row3"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="#drawable/row" />
<TextView
android:id="#+id/textRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/row3"
android:layout_alignTop="#id/row3"
android:layout_alignRight="#id/row3"
android:layout_alignBottom="#id/row3"
android:layout_margin="1dp"
android:gravity="center"
android:text="CORNERS"
android:textColor="#000000"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowLeftRow3"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row3"
android:layout_alignBottom="#id/row3"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row3"
android:layout_alignRight="#+id/arrowLeftRow3"
android:layout_alignBottom="#id/row3"
android:layout_marginTop="0dp"
android:layout_marginRight="-45dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowRightRow3"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row3"
android:layout_alignBottom="#id/row3"
android:layout_alignParentRight="true"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/arrowRightRow3"
android:layout_alignTop="#id/row3"
android:layout_alignBottom="#id/row3"
android:layout_marginLeft="-45dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="390dp"
android:layout_height="0dp"
android:layout_marginBottom="25dp"
android:layout_weight="1">
<ImageView
android:id="#+id/row4"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="#drawable/row" />
<TextView
android:id="#+id/textRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/row4"
android:layout_alignTop="#id/row4"
android:layout_alignRight="#id/row4"
android:layout_alignBottom="#id/row4"
android:layout_margin="1dp"
android:gravity="center"
android:text="OFFSIDES"
android:textColor="#000000"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowLeftRow4"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row4"
android:layout_alignBottom="#id/row4"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row4"
android:layout_alignRight="#+id/arrowLeftRow4"
android:layout_alignBottom="#id/row4"
android:layout_marginTop="0dp"
android:layout_marginRight="-45dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowRightRow4"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row4"
android:layout_alignBottom="#id/row4"
android:layout_alignParentRight="true"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/arrowRightRow4"
android:layout_alignTop="#id/row4"
android:layout_alignBottom="#id/row4"
android:layout_marginLeft="-45dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
</RelativeLayout>
<Button
android:id="#+id/buttonReset"
android:layout_width="150sp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_margin="50dp"
android:layout_marginBottom="5dp"
android:layout_weight="0.5"
android:background="#drawable/reset"
android:text="RESET"
android:textColor="#cdc2b1"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>
What I get from preview:
What I get from Emulator:
What I get from my Android Phone:
I found that I have used on top
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
That pushed 10dp the layout inside. Then I used static 390dp in RelativeLayout and that probably pushed outside the image living the arrows out of place.
<RelativeLayout
android:layout_width="390dp"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_marginBottom="25dp"
android:layout_weight="1">
By removing android:layout_margin="10dp" from top LinearLayout it looked fine now in Android's Studio emulator also! So in case you see similar problem check margins in parent Layouts

Ripple effect isn't fire properly onClick

I'm trying to use this lib https://github.com/traex/RippleEffect. I tried the sample and everything works fines but when I try to use this with more views inside the RippleView like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ripple="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:id="#+id/drive_layoutT"
android:layout_height="72dp"
android:weightSum="1"
android:background="#fff"
android:orientation="horizontal">
<com.andexert.library.RippleView
android:id="#+id/rippleView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ripple:rv_color="#797979">
<LinearLayout
android:layout_width="fill_parent"
android:id="#+id/drive_layout"
android:layout_height="72dp"
android:weightSum="1"
android:background="#fff"
android:orientation="horizontal">
<ImageView
android:id="#+id/drive_icon"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:padding="4dp" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="71dp"
android:layout_marginLeft="14dp">
<ImageView
android:id="#+id/drive_menu_btn"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:clickable="true"
android:paddingRight="10dp"
android:src="#drawable/button_overflow_menu"
android:layout_marginRight="2dp" />
<View
android:layout_width="22dp"
android:layout_height="22dp"
android:id="#+id/drive_badge"
android:padding="8dp"
android:background="#drawable/circle"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/drive_menu_btn"
android:layout_toStartOf="#+id/drive_menu_btn" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/drive_name"
android:textColor="#color/grey_list_item_title"
android:textSize="16sp"
android:ellipsize="end"
android:singleLine="true"
android:layout_alignTop="#+id/drive_menu_btn"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="#+id/drive_spinner"
android:layout_toStartOf="#+id/drive_spinner" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/drive_details"
android:textColor="#color/grey_list_item_details"
android:textSize="10sp"
android:ellipsize="end"
android:singleLine="true"
android:layout_below="#+id/drive_name"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="#+id/drive_badge"
android:layout_toStartOf="#+id/drive_badge" />
<ProgressBar
style="#style/CustomProgressBar"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:id="#+id/drive_progress_bar"
android:layout_below="#+id/drive_details"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="3dp"
android:layout_marginRight="16dp"
android:indeterminate="false" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="9"
android:id="#+id/drive_badge_text"
android:layout_marginRight="6.5dp"
android:layout_marginEnd="6dp"
android:layout_centerVertical="true"
android:layout_alignRight="#+id/drive_badge"
android:layout_alignEnd="#+id/drive_badge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="+"
android:id="#+id/drive_badge_plus"
android:textSize="7sp"
android:layout_marginRight="3dp"
android:layout_marginEnd="2dp"
android:layout_centerVertical="true"
android:layout_alignRight="#+id/drive_badge"
android:layout_alignEnd="#+id/drive_badge" />
<ProgressBar
style="?android:attr/progressBarStyleSmall"
android:layout_width="30dp"
android:layout_height="30dp"
android:id="#+id/drive_spinner"
android:layout_alignBottom="#+id/drive_details"
android:layout_toLeftOf="#+id/drive_badge"
android:layout_toStartOf="#+id/drive_badge"
android:indeterminate="false"
android:layout_marginBottom="3dp" />
</RelativeLayout>
<View
android:id="#+id/drive_divider"
android:layout_width="match_parent"
android:layout_height="0.8dp"
android:background="#color/grey_divider"
android:layout_marginTop="0dp"
android:layout_marginLeft="8dp" />
</LinearLayout>
</LinearLayout>
</com.andexert.library.RippleView>
</LinearLayout>
The ripple effect doesn't fire onClick, if I make a long press click I can see that the ripple effect happens. So this leads to a conclusion which is that this delay is caused because the RippleView is loading all the views inside.
How can I fixe this? Or is there anything I'm getting wrong or any work around for this issue?

Android center bottom numberpickers

I'm trying to create two number pickers in android. However i try to center them both at the bottom. I tried to mix up relative and linear layout, but i was not able to fix it.
The images shows how the buttons are placed at the moment. The red squares show how i want the buttons to be displayed.
Hope you can help me.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.pvdl.ndwatch.NDwatchActivity$PlaceholderFragment" >
<ImageView
android:id="#+id/background"
android:layout_width="wrap_content"
android:layout_height="300dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:scaleType="centerCrop"
android:src="#drawable/background" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/nd_text"
android:textColor="#color/red"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:src="#drawable/ic_launcher" />
<View
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_marginLeft="150dp"
android:layout_marginTop="90dp"
android:background="#00ABCC" />
<TextView
android:id="#+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="150dp"
android:layout_marginTop="20dp"
android:text="#string/title"
android:textColor="#404041"
android:textSize="60sp" />
<TextView
android:id="#+id/title2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="200dp"
android:layout_marginTop="30dp"
android:text="#string/title2"
android:textColor="#404041"
android:textSize="50sp" />
<RelativeLayout
android:id="#+id/frame"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textView1"
android:layout_centerHorizontal="true" >
</RelativeLayout>
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="270dp"
android:layout_height="270dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#android:color/transparent"
android:indeterminate="false"
android:max="100"
android:progress="0"
android:progressDrawable="#drawable/circular_progress_bar" />
<ImageButton
android:id="#+id/imageButton1"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignBottom="#+id/background"
android:layout_centerHorizontal="true"
android:layout_marginBottom="60dp"
android:background="#android:color/transparent"
android:onClick="onNDstart"
android:scaleType="fitXY"
android:src="#drawable/custom_button" />
<Chronometer
android:id="#+id/chronometer1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/imageButton1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp"
android:background="#android:color/transparent"
android:text="Chronometer"
android:textColor="#000000"
android:textSize="70sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/background"
android:layout_marginBottom="40dp"
android:layout_centerHorizontal="true"
android:text="#string/start"
android:textColor="#color/red"
android:textStyle="bold" />
<NumberPicker
android:id="#+id/numberPicker2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:entries="#array/shutter_times"
/>
<NumberPicker
android:id="#+id/numberPicker1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_weight="1"
android:entries="#array/nd_values"
android:gravity="bottom" />
</RelativeLayout>
Change your xml to this:
<RelativeLayout ...>
....
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="2" >
<NumberPicker
android:id="#+id/numberPicker2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:entries="#array/shutter_times" />
<NumberPicker
android:id="#+id/numberPicker1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:entries="#array/nd_values" />
</LinearLayout>
</RelativeLayout>
If you want a space between the buttons just add a paddingRight to the left button and the same value to the paddingLeft of the right button.
Hope this helps.

Trouble using AndroidSlidingPanel

I am trying to use this android sliding panel in my application.
The problem is, it is taking up my whole screen and intercepting all clicks, no matter where I click, it just opens and closes the panel. I'd like it to be at the bottom and I just drag it up to show the content then drag it down to remove the content.
How can I achieve this?
Here is my xml code.
NOTE: I have tried putting the tab below something low in my screen but that makes the content not show much... I cannot find a way around this. Any help is appreciated.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/whole_screen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/behindChessBoard"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<GridLayout
android:id="#+id/chessBoard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:columnCount="8"
android:rowCount="8" >
<ImageButton
android:id="#+id/cell00"
android:layout_column="0"
android:layout_row="0"
android:background="#color/chessTan"
android:scaleType="fitXY"
android:contentDescription="00" />
... ... .. . .. ...
</GridLayout>
<View
android:id="#+id/fakeView"
android:layout_height="0dp"
android:layout_width="0dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
<View
android:id="#+id/fakeViewTop"
android:layout_height="0dp"
android:layout_width="0dp"
android:layout_alignParentTop="true" />
<TextView
android:id="#+id/checkText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_centerHorizontal="true"
android:layout_below="#+id/soundSwitch"
android:textSize="24sp"
android:textColor="#color/win8_red" />
<ImageButton
android:id="#+id/undoButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="12dp"
android:layout_marginRight="6dp"
android:layout_toLeftOf="#+id/fakeView"
android:layout_above="#+id/fakeView"
android:scaleType="fitXY"
android:padding="0dp"
android:clickable="true" />
<ImageButton
android:id="#+id/redoButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="12dp"
android:layout_marginLeft="6dp"
android:layout_toRightOf="#+id/fakeView"
android:layout_above="#+id/fakeView"
android:scaleType="fitXY"
android:padding="0dp"
android:clickable="true" />
<ImageButton
android:id="#+id/changeBoardColorsButton"
android:layout_width="36dp"
android:layout_height="36dp"
android:visibility="gone"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:scaleType="fitXY"
android:padding="0dp"
android:clickable="true" />
<ImageButton
android:id="#+id/deleteButton"
android:layout_width="70dp"
android:layout_height="24dp"
android:layout_centerVertical="true"
android:scaleType="fitXY"
android:padding="0dp"
android:layout_toRightOf="#+id/chessBoard"
android:layout_marginTop="10dp"
android:layout_below="#+id/loadButton"
android:clickable="true" />-->
<Button
android:id="#+id/doneButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:scaleType="fitXY"
android:layout_marginTop="24dp"
android:text="Done"
android:textSize="20sp"
android:visibility="invisible" />
<RadioButton
android:id="#+id/blacksTurnIndicator1"
android:layout_width="36dp"
android:button="#layout/radio_selector"
android:layout_height="36dp"
android:layout_above="#+id/chessBoard"
android:clickable="false"
android:layout_centerHorizontal="true" />
<RadioButton
android:id="#+id/blacksTurnIndicator2"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_above="#+id/chessBoard"
android:button="#layout/radio_selector"
android:clickable="false"
android:layout_toLeftOf="#+id/blacksTurnIndicator1" />
<RadioButton
android:id="#+id/blacksTurnIndicator3"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_above="#+id/chessBoard"
android:button="#layout/radio_selector"
android:clickable="false"
android:layout_toRightOf="#+id/blacksTurnIndicator1" />
<RadioButton
android:id="#+id/whitesTurnIndicator1"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_below="#+id/chessBoard"
android:checked="true"
android:button="#layout/radio_selector"
android:clickable="false"
android:layout_centerHorizontal="true" />
<RadioButton
android:id="#+id/whitesTurnIndicator2"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_below="#+id/chessBoard"
android:checked="true"
android:button="#layout/radio_selector"
android:clickable="false"
android:layout_toLeftOf="#+id/whitesTurnIndicator1" />
<RadioButton
android:id="#+id/whitesTurnIndicator3"
android:layout_width="36dp"
android:layout_height="36dp"
android:button="#layout/radio_selector"
android:layout_below="#+id/chessBoard"
android:checked="true"
android:clickable="false"
android:layout_toRightOf="#+id/whitesTurnIndicator1" />
<com.example.chess.SlidingUpPanelLayout
android:id="#+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom" >
<TextView
android:id="#+id/messageTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|left"
android:layout_alignBottom="#+id/messageEditText"
android:textColor="#color/white"
android:textSize="18sp" />
<EditText
android:id="#+id/messageEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter message..."
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/sendMessageButton"
android:textColor="#color/white"
android:textSize="18sp"
android:maxLines="2" />
<ImageButton
android:id="#+id/sendMessageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/send_message_button"
android:scaleType="fitXY"
android:padding="0dp"
android:layout_alignParentBottom="true"
android:visibility="invisible"
android:layout_alignParentRight="true" />
</RelativeLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|bottom"
android:textColor="#color/DarkGoldenrod"
android:text="Chat"
android:textSize="28sp" />
</com.example.chess.SlidingUpPanelLayout>
</RelativeLayout>
</LinearLayout>
From the link you provided for the library it states
To use the layout, simply include com.sothree.slidinguppanel.SlidingUpPanelLayout as the Root element in your activity Layout.
Please read the documentation, its clear enough.

Categories

Resources