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.
Related
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 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
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
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?
I have a problem: the buttons from b0 to b9 and the button "Raspuns_user" are not visible on the screen.
How should I use Relative and Linear Layout in this case?
The buttons from b0 to b9 are keyboard numbers and I've put them in a LinearLayout beacuse I want them to stay in rows.
Any suggestions?
thank you!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context=".MyActivity"
android:background="#drawable/banda"
android:screenOrientation="portrait"
android:id="#+id/banda_bk"
android:clickable="false"
android:visibility="visible">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="#+id/ImageView1"
android:src="#drawable/obj1"
android:visibility="gone"
android:layout_marginRight="67dp"
android:layout_alignTop="#+id/printfirst"
android:layout_alignRight="#+id/answer"
android:layout_alignEnd="#+id/answer" />
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="#+id/ImageView2"
android:layout_marginTop="78dp"
android:src="#drawable/obj2"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="121dp"
android:visibility="gone"/> <!-- la inceput toate invisible-->
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="#+id/ImageView3"
android:layout_marginTop="78dp"
android:src="#drawable/obj3"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="121dp"
android:visibility="gone"/> <!-- la inceput toate invisible-->
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="#+id/ImageView4"
android:layout_marginTop="78dp"
android:src="#drawable/obj4"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="121dp"
android:visibility="gone"/> <!-- la inceput toate invisible-->
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="#+id/ImageView5"
android:layout_marginTop="78dp"
android:src="#drawable/obj5"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="121dp"
android:visibility="gone"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="#string/Scor"
android:id="#+id/textViewScor"
android:layout_marginRight="34dp"
android:textColor="#color/textbody"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberSigned"
android:ems="10"
android:id="#+id/answer"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:visibility="visible"
android:text="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/printfirst"
android:layout_alignParentTop="true"
android:layout_alignLeft="#+id/textViewScor"
android:layout_alignStart="#+id/printfirst"
android:layout_marginTop="23dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:visibility="gone" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/printsecond"
android:layout_below="#+id/printfirst"
android:layout_alignLeft="#+id/printfirst"
android:layout_alignStart="#+id/printfirst"
android:layout_marginTop="26dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:visibility="gone" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Raspunsul tau"
android:id="#+id/button"
android:layout_alignBaseline="#+id/answer"
android:layout_alignBottom="#+id/answer"
android:layout_alignRight="#+id/printsecond"
android:layout_alignEnd="#+id/printsecond" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/correctanswer"
android:layout_below="#+id/printsecond"
android:layout_alignRight="#+id/printsecond"
android:layout_alignEnd="#+id/printsecond"
android:layout_marginTop="24dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Verifica si genereaza alte nr"
android:id="#+id/buton2"
android:layout_alignTop="#+id/correctanswer"
android:layout_alignRight="#+id/printsecond"
android:layout_alignEnd="#+id/printsecond" />
<LinearLayout
android:id="#+id/row0"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
android:id="#+id/Raspuns_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:maxLines="1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="0"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="40sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/row1"
android:layout_width="match_parent"
android:layout_height="0dp">
<Button
android:id="#+id/b0"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".25"
android:text="#string/b0"
android:textSize="25sp" />
<Button
android:id="#+id/b1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".25"
android:text="#string/b1"
android:textSize="25sp"
android:visibility="visible" />
<Button
android:id="#+id/b2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".25"
android:text="#string/b2"
android:textSize="25sp"
android:visibility="visible" />
<Button
android:id="#+id/b3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".25"
android:text="#string/b3"
android:textSize="25sp"
android:visibility="visible" />
<Button
android:id="#+id/b4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".25"
android:text="#string/b4"
android:textSize="25sp"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:id="#+id/row2"
android:layout_width="match_parent"
android:layout_height="0dp">
<Button
android:id="#+id/b5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".25"
android:text="#string/b5"
android:textSize="25sp"
android:visibility="visible"
android:focusableInTouchMode="false"
android:enabled="false" />
<Button
android:id="#+id/b6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".25"
android:text="#string/b6"
android:textSize="25sp"
android:visibility="visible" />
<Button
android:id="#+id/b7"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".25"
android:text="#string/b7"
android:textSize="25sp"
android:visibility="visible" />
<Button
android:id="#+id/b8"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".25"
android:text="#string/b8"
android:textSize="25sp"
android:visibility="visible" />
<Button
android:id="#+id/b9"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".25"
android:text="#string/b9"
android:textSize="25sp"
android:visibility="visible" />
</LinearLayout>
</RelativeLayout>
Change the layout_height="0dp to wrap_content and also set the
android:layout_width="0dp" from the buttons to android:layout_width="wrap_content"
Change the height of Linear layout from
android:layout_height="0dp"
to
android:layout_height="wrap_content"
Solution :
Problem with Your layout is that you have used android:layout_height="0dp"
instead of that use android:layout_height="wrap_content"
More Info :
LinearLayout is used to set layout childs either HORIZONTAL or VERTICAL.
So it set positions as you declared in XML but it doesn't happen with RelativeLayout.
In RelativeLayout you have to set positions of your childViews.
Its the basic difference between both layouts..
You are using RelativeLayout
It uses properties like below to set positions of ChildViews in layout screen
android:layout_above
android:layout_below
android:layout_toLeftOf
android:layout_toRightOf
read about Layouts for more details...
Hope this helps...