Can any one please tell me, how to disable segmentedcontrol in android.
I have been using Foursquared library.
The link for library is given below.
You can do one thing for that.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<SegmentedButton
android:id="#+id/login_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
/>
<Layout
android:id="#+id/transperent_fragment"
android:name="com.test.transperentFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/body_texture"
android:alpha="0.2"
android:clickable="true"/>
</RelativeLayout>
Hope this helps you..:)
Related
I set ViewPager's height wrap_content but it doesn't work. I tried answers in other similar questions but they didn't solve my problem. my activity_main code is this:
<?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:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#C49A1544"
tools:context=".MainActivity">
<include layout="#layout/toolbar"
android:id="#+id/main_toolbar"/>
<androidx.viewpager.widget.ViewPager
android:id="#+id/viewpager"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/standard_margin_x2"
android:layout_below="#id/main_toolbar"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" />
</RelativeLayout>
and I have 3 fragment layouts. really sorry for my low English, I am a beginner in Android app development please help me.
I found a solution myself. If we use UltraViewPager library instead of the default, the problem will be solved, but this library has bugs. Anyway, thank you for trying to help me with your comments.
I'm trying to add an elevated base to an layout and I can't manage to do that. If someone know how to help me a little it would be appreciated.
This is the base I want to get:
You can simple achieve this using MaterialCardView by following code snippet :
<com.google.android.material.card.MaterialCardView
android:layout_margin="8dp"
android:layout_width="match_parent"
android:layout_height="100dp"
app:cardCornerRadius="0dp"
app:cardElevation="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--Rest of your layout code goes here-->
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
Happy Coding :)
I need to make FloatingActionButton always stick to the bottom of my fragment where I display WebView. The problem is that the button in my current XML is cut in half and I can't manage to fix it. Here is my layout.
<FrameLayout 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"
android:background="#color/colorBackgroundWhite"
tools:context=".fragments.CpuComparisionFragment">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="#+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/button_compare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginBottom="#dimen/fb_margin_16dp"
android:layout_marginEnd="#dimen/fb_margin_16dp"
android:alpha="0.7"
android:src="#drawable/ic_compare" />
</android.support.design.widget.CoordinatorLayout>
</FrameLayout>
What am i doing wrong? Any ideas how to fix this? Here is screenshot how my app looks now.
It seems the android version installed on the device you're testing your app on doesn't support some of your xml attributes. Anyways, replace the FAB code with the below snippet. I hope it work for you.
<android.support.design.widget.FloatingActionButton
android:id="#+id/button_compare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginBottom="#dimen/fb_margin_16dp"
android:layout_marginEnd="#dimen/fb_margin_16dp"
android:alpha="0.7"
app:layout_anchorGravity="bottom|right|end"
android:src="#drawable/ic_compare" />
Try to add android:fitsSystemWindows="true" to your FrameLayout .
I am learning Android these days, and I am having some trouble implementing something. When I click on the image icon, I want a menu to appear from below. The screenshot is as below. (Sorry it's in chinese....)
There's awesome library on github to get your task done.
All you need to do is setup your layout in two part as describe in below code
part 1: Your main activity(main frame)
part 2: bottom Panel which will be shown when user swipe/click on button.
You must check how to set "anchor point true" in library document.
<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:id="#+id/bottom_panel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:umanoDragView="#+id/dragView"
sothree:umanoPanelHeight="68dp"
sothree:umanoParalaxOffset="10dp">
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<RelativeLayout
android:id="#+id/panel"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--This is bottom layout.-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00FF00"
android:orientation="vertical">
<Button
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#0000FF"
android:text="Button 1" />
<Button
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#0000FF"
android:text="Button 1" />
<Button
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#0000FF"
android:text="Button 1" />
</LinearLayout>
</RelativeLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
I think what you are trying to do here is to replicate the action sheet of iOS in android. There is this library which does exactly what you are looking for, https://github.com/baoyongzhang/android-ActionSheet . You can either have it as it as it is provided by author or you can clone it and suit your need accordingly. I would prefer if you could clone it as a module in your app that way you have limitless way to re-design it. If you need help on that let us know
You can simply follow the below link , it will implement what u need :
http://trickyandroid.com/fragments-translate-animation/
This will be done through Transition Fragment Animation .
Is there any way to set the navigation drawer as visible always?.
So that the user knows that there is something on the right/left.
Like what you see in Hangouts app.
I know hangouts uses SlidePaneLayout, But anyone knows how to achieve this using Navigation Drawer?.
Got It!!.. Simplicity at its best. No libraries, No complicated codes. Use SimplePaneLayout.
Just set the android:layout_marginLeft to a suitable value. :) Awesome :)
<android.support.v4.widget.SlidingPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/slidingpanelayout">
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#CCC"
android:orientation="horizontal"
android:id="#+id/fragment_firstpane"/>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000"
android:orientation="horizontal"
android:layout_marginLeft="40dp"
android:id="#+id/fragment_secondpane"/>
</android.support.v4.widget.SlidingPaneLayout>