android-layout

Double Taxation when using a RelativeLayout on Android

送分小仙女□ 提交于 2020-08-06 05:39:08
问题 In order to understand Double Taxation on Android, I wrote the following code which is pretty simple. There is a RelativeLayout with three TextView s. <?xml version="1.0" encoding="utf-8"?> <ru.maksim.sample_app.MyRelativeLayout 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" tools:context="ru.maksim.sample_app.MainActivity"> <ru.maksim.sample_app.MyTextView

How to coordinate a Navigation Drawer with a Buttom Navigation View

倾然丶 夕夏残阳落幕 提交于 2020-08-05 08:06:17
问题 I'm fairly new to android dev. I'm checking the material design library and I've implemented a navigation drawer with a bottom navigation to navigate easily through fragments. Both components work just fine but I don't how to coordinate the navigation with both components. For example when a fragment is toggled on the navigation drawer it changed the layout but the button navigation selected item is not changed with it. How can I solve this issue and link both components to work with each

Android studio layout xml not updating

老子叫甜甜 提交于 2020-08-03 17:56:17
问题 I am using Android Studio latest version and recently facing a problem that, my layout xml Design view not getting updated rapidly if I have changed background from selector resource or changed the image resource background . I found that Rebuild Project again updating the layout. But my project is little big and its taking some time to rebuild again. It would be nice if there is any other quick solution for this. I have also tried the Synchronize xml option, but not worked as expected.

Set ConstraintLayout width to match parent width programmatically

…衆ロ難τιáo~ 提交于 2020-08-02 10:57:33
问题 In an android application I am attempting to programmatically add customized ConstraintLayout views to a vertically oriented LinearLayout . I set the LayoutParams to MATCH_PARENT for width and WRAP_CONTENT for height in the ConstraintLayout s. However, when I run the application the ConstraintView is all scrunched up and the content is overlapping. Below are some relevant snippets and a screenshot of my application. How do I go about correcting this issue? public class ItemView extends

How to change hamburger icon in Android (NavigationDrawer)

若如初见. 提交于 2020-08-02 08:18:06
问题 Before write this thread I have try to implement the different solution that I found in stackoverflow, but nothing work properly. I'm developing an Android applucation that use the custom navigation drawer, I have to change the standard icon of actionbar (now is toolbar, right ?), and settings icon. This is my code: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id

How to set color using integer?

耗尽温柔 提交于 2020-08-02 07:38:07
问题 How can i convert color code in integer ex: 13369395 to android specific. Since 13369395 is also an integer i tried doing mainLayout.setTextColor(13369395); but its not working. I also tried converting 13369395 to hexadecimal like: mainLayout.setBackgroundColor(Integer.parseInt(13369395 +"", 16)+0xFF000000); but it also didn't help. 回答1: I got the solution. Just a work around with Hexadecimal as below: Integer.toHexString(colour); Which returns the hexadecimal string for your integer, again

How to scroll recyclerView programmatically?

≡放荡痞女 提交于 2020-08-01 10:44:01
问题 I have a horizontal recyclerView, When I first open the activity I want to make all the items in recyclerview scroll to the bottom (to the right in this case) and back to the top (to the left). Kinda like an animation. Scroll behavior should be visible to the user. I tried to do it like: Animation slideRight = AnimationUtils.loadAnimation(this, R.anim.slide_right); Animation slideLeft = AnimationUtils.loadAnimation(this, R.anim.slide_left); slideRight.setDuration(1000); slideLeft.setDuration

How to scroll recyclerView programmatically?

一曲冷凌霜 提交于 2020-08-01 10:41:05
问题 I have a horizontal recyclerView, When I first open the activity I want to make all the items in recyclerview scroll to the bottom (to the right in this case) and back to the top (to the left). Kinda like an animation. Scroll behavior should be visible to the user. I tried to do it like: Animation slideRight = AnimationUtils.loadAnimation(this, R.anim.slide_right); Animation slideLeft = AnimationUtils.loadAnimation(this, R.anim.slide_left); slideRight.setDuration(1000); slideLeft.setDuration

Changing app locale sometimes doesn't change direction of layouts

♀尐吖头ヾ 提交于 2020-07-23 07:34:19
问题 I'm changing locale of my app programmatically using the following method. It works fine but when I start an already existing singleTask activity using Intent.FLAG_ACTIVITY_CLEAR_TOP flag. Then application loses the layout direction but translation is correct. For example, if application language is Arabic then all views direction is changed to English locale (left-to-right). What could be the reason? I'm calling following method in attachBaseContext of BaseActivity and Application class.

Changing app locale sometimes doesn't change direction of layouts

萝らか妹 提交于 2020-07-23 07:33:16
问题 I'm changing locale of my app programmatically using the following method. It works fine but when I start an already existing singleTask activity using Intent.FLAG_ACTIVITY_CLEAR_TOP flag. Then application loses the layout direction but translation is correct. For example, if application language is Arabic then all views direction is changed to English locale (left-to-right). What could be the reason? I'm calling following method in attachBaseContext of BaseActivity and Application class.