logo
down
shadow

selectableItemBackground with white background on tablayout?


selectableItemBackground with white background on tablayout?

By : Hacke Peson
Date : November 20 2020, 11:01 PM
I hope this helps . finally, I find out how to get a background and selectable item together. first you need to declare two styles in your styles.xml, like below
code :
<style name="SelectableItemTheme">
    <item name="colorControlHighlight">@color/light_gray</item>
</style>
<style name="SelectableItemBackground">
    <item name="android:theme">@style/SelectableItemTheme</item>
    <item name="android:background">?attr/selectableItemBackground</item>
</style>
<android.support.design.widget.TabLayout
   android:id="@+id/tabs"
   android:layout_width="match_parent"
   android:layout_height="60dp"
   android:layout_alignParentStart="true"
   style="@style/SelectableItemBackground"
   android:background="@color/background_login"/>                   


Share : facebook icon twitter icon
Make background inherit from selectableItemBackground

Make background inherit from selectableItemBackground


By : user3236361
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Ok, so it can be done for 21+ android, where https://code.google.com/p/android/issues/detail?id=26251 is fixed.
code :
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:attr/selectableItemBackground" />
<item android:top="-2dp" android:right="-2dp" android:left="-2dp">
    <selector>
        <item android:state_activated="true">
            <shape>
                <solid android:color="@android:color/transparent" />
                <stroke
                        android:width="2dp"
                        android:color="#910E12" />
            </shape>
        </item>
    </selector>
</item>
</layer-list>
?android:attr/selectableItemBackground not working on white windowBackground

?android:attr/selectableItemBackground not working on white windowBackground


By : christene botha
Date : March 29 2020, 07:55 AM
this will help I would like to use , in my styles.xml I was using
code :
Theme.AppCompat.NoActionBar 
style name="CustomMaterialTheme" parent="Theme.AppCompat.Light.NoActionBar"
Using ?selectableItemBackground with a white background color

Using ?selectableItemBackground with a white background color


By : Manali
Date : March 29 2020, 07:55 AM
wish helps you I've always been using android:background="?selectableItemBackground" for a ripple effect when a view (a LinearLayout for example) is clicked. I think I read somewhere that this is backwards compatible to API 14. , You can use the foreground of your FrameLayout :
code :
<FrameLayout ...
    android:background="@android:color/white"
    android:foreground="?attr/selectableItemBackground">
Shaped drawable with selectableItemBackground as background

Shaped drawable with selectableItemBackground as background


By : hande
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I have couple buttons that I need an oval shaped border. , Having round_corners.xml:
code :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
    <solid android:color="@android:color/transparent"/>
    <corners android:radius="15dp" />
    <stroke
        android:width="1px"
        android:color="#000000" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
        android:color="?android:attr/colorControlHighlight">
    <item android:id="@android:id/mask">
        <shape android:shape="rectangle">
            <solid android:color="#000000" />
            <corners android:radius="15dp" />
        </shape>
    </item>
    <item android:drawable="@drawable/round_corners" />
</ripple>
<Button
    android:background="@drawable/my_ripple"
    ... />
When I set android background to white, tablayout and menu items background also turned white

When I set android background to white, tablayout and menu items background also turned white


By : benj
Date : March 29 2020, 07:55 AM
seems to work fine By setting android:background in your styles it affects (nearly) everything I guess. Simply set android:background="@color/white" to your root LinearLayout of your activity_main.xml like
code :
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/white"
android:orientation="vertical">
Related Posts Related Posts :
  • How to find the minimum and maximum dates from three tables even if there is no date in one table in android sqlite
  • Unparseable date: "10:40:54" (at offset 0)
  • Keep count of consumable in-app purchases using Firebase Realtime Database
  • Proguard with Parceler and Realm
  • Check whether the file is already exists Android not working
  • Update value to mutiply objects by Transaction in Firebase
  • how to save another image in android?
  • android thread only runs once
  • working with custom views and sqlite database-android
  • Android 4.x - NavigationView ignores android:theme parameter
  • Travis CI with Android Lib - No compatible devices connected
  • A blank white screen appeared when addview to windowmanager
  • Error:Cannot set readonly property: proguardFiles for class: com.android.build.gradle.managed.BuildType
  • How do I display an ImageView underneath the middle of a LinearLayout?
  • Why setVisibility only works setOnClickListener but not in onClick?
  • How can I get packets data from AudioStream Android?
  • How to import open source library as an external project into Android Studio?
  • Android Studio Gradle API compatibility
  • Travis CI Build failing on Android app Unsupported major.minor version 52
  • Android clearing notifications not detected
  • Android updating custom preference summary
  • How to clear a recyclerview on app start
  • cordova plugin rm cordova-plugin-whitelist does not change config.xml so it will be readded upon build
  • Html.fromHtml on Nougat doesn't call custom HtmlHandler
  • Android Very huge list of items with recyclerview best approach
  • error generating signed CSR with javacard (asn1 bad tag value)
  • Dagger2 Inject a lot of activities/fragments/services (possible get a lot of NPE)
  • images vs views(button, radiobutton....) in Android
  • Not able to stop service, stopService()-method doesn't work
  • Android sharing between apps using ContentUri
  • Write text with canvas (onDraw view)
  • Trouble with implementing app for different screens on Android
  • Android remove EditText selection
  • Batch job - violate constraint temporarily
  • I get HTTP 400 when using oauth post request
  • how to launch new activity based on spinner value
  • How to grab multiple paths and sort them and bring back the result in firebase?
  • Android - Cursor not properly working
  • Android MapView getlongitude and getlatitude returns 0.0 on volley request
  • Android: externalize "@android:color/transparent" in the colors.xml resources file
  • When trying to rid my app of the title bar, my app crashes
  • Android: GCM Error - string/gcm_defaultSendorid Error:Duplicate resources error
  • Appodeal Rewarded ads failed to Load
  • What is the difference b/w animateCamera and moveCamera in google V2 maps?
  • How to stop CountDownTimer in android
  • realm results empty after clearing app from multitask using a service
  • Why do I have several states change for a BroadcastReceiver On Wifi changes
  • Conveniently open SDK sources in Android Studio / IntelliJ
  • Do you think Thead.sleep() is a good approach in Service?
  • Is recommended to release CvCameraViewFrame inputFrame?
  • Count Down Timer app has issue when I change orientation
  • Is moving IAB purchases between apps possible?
  • Android custom shape for zoom buttons
  • Rendering issue in XML preview : Unable to locate mode 0
  • Firebase Error cannot access zzanb after using play-services-xxx:9.8.00
  • Android JWPlayer conflicts with Play Services
  • Writing a file from Jsoup document on Andorid and search for specific token
  • Simple FFMpeg player for Android
  • How can I use QOpenGLWidget on Android?
  • Set selected item in Android BottomNavigationView
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com