android-layout

How to make a drawable Shape programmatically (Android)

给你一囗甜甜゛ 提交于 2020-04-08 14:42:07
问题 i'm making a custom TextView (Java class) and i'm having trouble "to translate" the line (on "original TextView" xml) android:background="@drawable/myDrawableShape" to a java void to change the color of the "myDrawableShape" myDrawableShape.xml <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#ffafafaf" /> <corners android:radius="15dp" /> I'll get the color to set from a String, the void to change the color programmatically could be (for example) void

How to sync TabLayout with Recyclerview?

流过昼夜 提交于 2020-04-08 05:57:52
问题 I have a TabLayout with Recyclerview so that when tabs are clicked then the Recyclerview is scrolled to a particular position. I want the reverse procedure as well such that when the Recyclerview is scrolled to a particular position then the particular tab is highlighted. For example: If there are 4 tabs in the TabLayout and when Recyclerview is scrolled to 5th position(Item visible and below TabLayout ) then 3rd tab should be highlighted. Here when 'How it works' appears below TabLayout then

How to fix androidx.appcompat.widget.AppCompatButton cannot be cast to com.rey.material.widget.Button

余生长醉 提交于 2020-03-26 01:00:54
问题 I'm building a amazon like app. after coding the loginactivity I can't access it from mainactivity because it always crashes this is my loginactivity.java public class loginActivity extends AppCompatActivity { private EditText InputPhoneNumber, InputPassword; private Button LoginButtonPage; private ProgressDialog loadingBar; private String parentDbname = "Users"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity

How to fix androidx.appcompat.widget.AppCompatButton cannot be cast to com.rey.material.widget.Button

我是研究僧i 提交于 2020-03-26 00:55:53
问题 I'm building a amazon like app. after coding the loginactivity I can't access it from mainactivity because it always crashes this is my loginactivity.java public class loginActivity extends AppCompatActivity { private EditText InputPhoneNumber, InputPassword; private Button LoginButtonPage; private ProgressDialog loadingBar; private String parentDbname = "Users"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity

Do I need to change my xml code for supporting all screen size android devices?

本秂侑毒 提交于 2020-03-25 18:49:16
问题 I have created layout for different screen size and this is my xml code for default layout but so any one please tell me what I should do to support my layout for any screen size android devices. do I need to change my xml code? or just I need to modify my xml code ? please tell me so I can solve my problem xlm <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"

How to set Custom Dialog background dim?

痞子三分冷 提交于 2020-03-25 18:00:31
问题 I made custom dialog and it doesn't make background color dim. I tried this code and it shows with black background. dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND); Also tried this, but it shows same result. Background is still black. window.setDimAmount(0.5f); This is my CustomDialog layout Code <?xml version="1.0" encoding="utf-8"?> <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android

Interaction betweens Fragments and Activity

生来就可爱ヽ(ⅴ<●) 提交于 2020-03-23 12:00:20
问题 I'm having some difficulty facing the interactions between Fragments and between Fragments and my Activity, especially ClickListener -wise. I'm developing a Calculator app composed of 2 fragments: one Fragment contains all the Buttons (numbers and operators) the other contains the 2 TextViews (operation and result) The goal here is to make these two Fragments communicate between each other. I'm supposed to send characters and strings to a TextView until I click the on the "equals" button (on

Android Splash Screen doesn't display

前提是你 提交于 2020-03-23 08:20:32
问题 I have the following splash screen defined (splash.xml): <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque"> <item android:drawable="@color/colorGold"/> <item> <bitmap android:gravity="center" android:src="@drawable/Banner2"/> </item> </layer-list> This is the style.xml: <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme

Android Splash Screen doesn't display

為{幸葍}努か 提交于 2020-03-23 08:20:30
问题 I have the following splash screen defined (splash.xml): <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque"> <item android:drawable="@color/colorGold"/> <item> <bitmap android:gravity="center" android:src="@drawable/Banner2"/> </item> </layer-list> This is the style.xml: <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme

ViewBinding - Different Flavor Layout Resource

白昼怎懂夜的黑 提交于 2020-03-23 08:00:10
问题 I have a flavor which contains the same layout resource that is in my main source set. This is so it overrides the main one with the flavor specific one. I have done this in many places and it works fine until I introduced ViewBinding . For accuracy, the layout is a nested layout that is "included" in a fragment. Here is the structure: main - res - - layout - - - layout_sign_up_details_fields.xml flavor - res - - layout - - - layout_sign_up_details_fields.xml I have a view, whose ID is til