android-layout

how to know which phone support which layout(hdpi , mdpi and xhpi)?

假如想象 提交于 2020-03-11 02:42:06
问题 I'm a little confused about how to determine which phones support what layout types. I've done some research but haven't found a satisfying answer. For example, I've found the below guide: xlarge screens are at least 960dp x 720dp large screens are at least 640dp x 480dp normal screens are at least 470dp x 320dp small screens are at least 426dp x 320dp However, I still have some concerns: Samsung grand (480*800) and HTC wild fire S (320*480) both support MDPI. These screens have very

How can i change background with random time?

折月煮酒 提交于 2020-03-04 05:05:39
问题 I'm new on stackoverflow and i want to learn answer this question please dont give me negative reputation. How can i change background color with random time and everytime on android studio ? I'm using kotlin language. var counter:Int =0 if (Random.nextBoolean()) background.setBackgroundColor(Color.GREEN) else background.setBackgroundColor(Color.RED) btn_touch.setOnClickListener { counter += 1 textCounter.text = counter.toString() 回答1: A fun coroutines answer: var loop = true GlobalScope

How do you display 24 hour time format in hourly increments on a time slider in android?

孤者浪人 提交于 2020-03-03 11:45:06
问题 I have a 2 step question here: 1) How do I display a time slider UI which scrolls horizontally upon touch in a 24-hour format? 2) How do I divide it into a 24 hour format with each slot consisting of a 1 hour slot each? The time slot is divided into hourly increments, such that only 8 hours are visible at a time ( but it's actually a 24 hour time slider which scrolls horizontally) Also, I am planning to make it such that based on the start and end time returned by the JSON I am using, it

How to change color in Material Components PROGRAMMATICALLY on Android?

浪尽此生 提交于 2020-03-03 09:08:10
问题 I'm looking for a solution to change the color of some Android Material Components layout objects. How can I change the color of text or borders in a Material Button programmatically? All functions like MaterialButton.setTexColor() do not work. Same thing for the StrokeColor. The change must be made logically, directly from code. No XML styles, colors must be able to change in live, based on values read from a database. Things like these don't work : //renewSetDate is a Material Button Object

How to change color in Material Components PROGRAMMATICALLY on Android?

て烟熏妆下的殇ゞ 提交于 2020-03-03 09:06:26
问题 I'm looking for a solution to change the color of some Android Material Components layout objects. How can I change the color of text or borders in a Material Button programmatically? All functions like MaterialButton.setTexColor() do not work. Same thing for the StrokeColor. The change must be made logically, directly from code. No XML styles, colors must be able to change in live, based on values read from a database. Things like these don't work : //renewSetDate is a Material Button Object

How to change color in Material Components PROGRAMMATICALLY on Android?

偶尔善良 提交于 2020-03-03 09:06:14
问题 I'm looking for a solution to change the color of some Android Material Components layout objects. How can I change the color of text or borders in a Material Button programmatically? All functions like MaterialButton.setTexColor() do not work. Same thing for the StrokeColor. The change must be made logically, directly from code. No XML styles, colors must be able to change in live, based on values read from a database. Things like these don't work : //renewSetDate is a Material Button Object

Tabbar layout active tab textcolor is same as primary color

断了今生、忘了曾经 提交于 2020-03-03 07:07:39
问题 This is my style: <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.MaterialComponents.DayNight"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style> <style name="AppTheme

WebView in my app is not loading an HTTPS URL

旧城冷巷雨未停 提交于 2020-03-03 03:05:36
问题 When I try to load a URL in the WebView it only shows a blank screen. If I load https://www.google.com or https://www.facebook.com it is working fine. package com.example.hp.cccapp; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.webkit.WebView; import android.webkit.WebViewClient; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R

WebView in my app is not loading an HTTPS URL

不羁岁月 提交于 2020-03-03 03:02:05
问题 When I try to load a URL in the WebView it only shows a blank screen. If I load https://www.google.com or https://www.facebook.com it is working fine. package com.example.hp.cccapp; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.webkit.WebView; import android.webkit.WebViewClient; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R

Android: remove shadow from bottom navigation

隐身守侯 提交于 2020-03-01 01:42:56
问题 When placing a container below my bottom navigation, it is partly covered by the gray shadow from the navigation, even after adding content to the container. How do I remove the shadow? 回答1: Use app:elevation="0dp" to hide shadow from from bottom navigation <android.support.design.widget.BottomNavigationView android:id="@+id/bottom_navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="@android:color