android-layout

Android - How to split a view in 4 equal parts? [closed]

☆樱花仙子☆ 提交于 2020-02-18 21:35:52
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I'd like to take a screen, divide it to four squares in different colors and attach a click listener to them. My question is how do I split the screen to 4 equal squares. Thanks in advance! Dvir 回答1: Here is a

using a custom color for button background while using selectableItemBackground attribute

人盡茶涼 提交于 2020-02-18 05:41:54
问题 I am trying to use android:background="?android:attr/selectableItemBackground" to get my button to do appropriate effects for each android version like rippling, etc. But this produces a button with a grey color when I need a different color. How can I override this default color ? 回答1: If you read the source code of Button.java then you will see that it is a subclass of TextView.java. I have made a simple workaround for the problem in question. <LinearLayout android:layout_width="wrap

using a custom color for button background while using selectableItemBackground attribute

余生长醉 提交于 2020-02-18 05:40:29
问题 I am trying to use android:background="?android:attr/selectableItemBackground" to get my button to do appropriate effects for each android version like rippling, etc. But this produces a button with a grey color when I need a different color. How can I override this default color ? 回答1: If you read the source code of Button.java then you will see that it is a subclass of TextView.java. I have made a simple workaround for the problem in question. <LinearLayout android:layout_width="wrap

CoordinatorLayout leaves empty bottom space

泄露秘密 提交于 2020-02-15 08:32:48
问题 I'm developing and Android App using Xamarin. I'm using the ViewPager with TabLayout to make tab navigation, but my ViewPager, even with height="match_parent" does not fill the whole screen. I believe it's some misconfiguration on CoordinatorLayout, but I can't find a way to fix it. My layout XML: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:local="http://schemas.android.com/apk/res

CoordinatorLayout leaves empty bottom space

这一生的挚爱 提交于 2020-02-15 08:30:12
问题 I'm developing and Android App using Xamarin. I'm using the ViewPager with TabLayout to make tab navigation, but my ViewPager, even with height="match_parent" does not fill the whole screen. I believe it's some misconfiguration on CoordinatorLayout, but I can't find a way to fix it. My layout XML: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:local="http://schemas.android.com/apk/res

How to center the content inside a linear layout?

坚强是说给别人听的谎言 提交于 2020-02-09 18:59:05
问题 I'm trying to center an ImageView inside a LinearLayout horizontally and vertically, but I just can't do it. The main reason why I'm not using a RelativeLayout for that is because I need the layout_weight (my Activity consists of four columns that should be equally divided, and also responsive to different screen widths, each column having an ImageView centered and unstretched). Here is my xml so far: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http:/

How to center the content inside a linear layout?

删除回忆录丶 提交于 2020-02-09 18:58:39
问题 I'm trying to center an ImageView inside a LinearLayout horizontally and vertically, but I just can't do it. The main reason why I'm not using a RelativeLayout for that is because I need the layout_weight (my Activity consists of four columns that should be equally divided, and also responsive to different screen widths, each column having an ImageView centered and unstretched). Here is my xml so far: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http:/

Passing a value from Activity to Fragment in Kotlin

时光毁灭记忆、已成空白 提交于 2020-02-06 11:31:58
问题 I created a bottom navigation activity in my project, which contains one activity and two fragments. In Main Activity I have value stored in a variable but if I pass the value to the fragments then I am getting NullPointer Exception error. I am using kotlin in my project and any help is appreciated. Expectation Get Value into Fragment from MainActivity. MainActivity--->TestOneFragment Language Used Kotlin Main Activity class Test : AppCompatActivity(), BottomNavigationView

Passing a value from Activity to Fragment in Kotlin

…衆ロ難τιáo~ 提交于 2020-02-06 11:28:53
问题 I created a bottom navigation activity in my project, which contains one activity and two fragments. In Main Activity I have value stored in a variable but if I pass the value to the fragments then I am getting NullPointer Exception error. I am using kotlin in my project and any help is appreciated. Expectation Get Value into Fragment from MainActivity. MainActivity--->TestOneFragment Language Used Kotlin Main Activity class Test : AppCompatActivity(), BottomNavigationView

Passing a value from Activity to Fragment in Kotlin

Deadly 提交于 2020-02-06 11:24:27
问题 I created a bottom navigation activity in my project, which contains one activity and two fragments. In Main Activity I have value stored in a variable but if I pass the value to the fragments then I am getting NullPointer Exception error. I am using kotlin in my project and any help is appreciated. Expectation Get Value into Fragment from MainActivity. MainActivity--->TestOneFragment Language Used Kotlin Main Activity class Test : AppCompatActivity(), BottomNavigationView