android-layout

Recycler view item enter animation not working

时间秒杀一切 提交于 2020-02-03 08:52:28
问题 I followed a tutorial for animating recyclerview item but the animation is not working iam confused that whether the animation is applied or not. Activity.Java: The updated code was here i tried with the button click but i dont know how to call the animation method from the onBindHolder form the adapter private void setupRecyclerView() { RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext()); recyclerView.setLayoutManager(mLayoutManager); final

Is there any difference between “center_horizontal|center_vertical” and “center”

霸气de小男生 提交于 2020-02-03 05:31:05
问题 I want to center an image in a linearLayout. Is there any difference between android:gravity="center_horizontal|center_vertical" and android:gravity="center" ? 回答1: No, there is no difference. According to source code public static final int CENTER = CENTER_VERTICAL|CENTER_HORIZONTAL; 回答2: There really is not difference between the two except that it's less code using center . combining center_horizontal and center_veritcal is the equivalent of center 回答3: I know this is old question but i

Removing the extra top space in CoordinatorLayout- Android

你说的曾经没有我的故事 提交于 2020-02-03 05:11:10
问题 I am trying to use BottomSheetBehavior to make a layout similar to what google maps is providing. I am successful in using the BottomSheetBehavior and create slide up layout. The problem I am having now is CordinatorLayout takes extra space even when my layout is collapsed. Below is a screenshot of my layout. White background in my main activity layout Pink is my collapsed layout with peekHeight And the grey background is the one which should be transparent but takes the extra space. My main

How to disable drawer layout from one side?

余生长醉 提交于 2020-02-03 04:37:06
问题 I have made a double drawer layout without an actionbar something like this: Using Navigation Drawer without TitleBar or ActionBar My requirement is to disable the drawer on right when drawer on left is open & vice versa. So I'm hiding the right drawer button when left drawer is open & vice versa and that works fine. But the problem is, even when I hide a button(left or right), the drawer still opens with horizontal swipe(right to left swipe). So how do I prevent the drawer from opening from

Show layout when soft keyboard opens

我们两清 提交于 2020-02-03 04:30:49
问题 There is a CardView with an EditText and when the keyboard opens, it is placed right below the EditText . But as shown below, the keyboard is too close to the EditText and it is hard to press the "send" button because there is not enough space. EditText: EditText with focus: Is there any way to show the keyboard after the end of the CardView? I saw some similar questions here, but none of them provide a solution that I need. Some answers suggest to set a paddingBotton in EditText, but that is

Set child layout width programmatically In ANDROID?

为君一笑 提交于 2020-02-03 03:42:27
问题 In my Code I have a XML file having multiple child layouts. Aand I just want to set one of these child layout's width programmatically according to device's screen width. till now I had tried Layout params, setparam, and other methods but it shows null pointer exception on getting layout id. my parent layout is a Relative Layout, and 1st Child Layout is a Linear Layout("for this layout I need to change width") <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id

layout_gravity center along with layout_marginRight issue

五迷三道 提交于 2020-02-02 16:26:07
问题 I am not able to get reason why there is difference in below two views, only difference is layout_gravity center is missing in second one <?xml version="1.0" encoding="utf-8"?> <View xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_gravity="top|center" android:layout_height="10dp" android:layout_marginRight="100dp" android:background="@android:color/holo_red_dark" /> <?xml version="1.0" encoding="utf-8"?> <View xmlns:android="http:/

How to show different Activities in Fragment implementation?

旧时模样 提交于 2020-02-02 11:06:46
问题 It is my first time using android fragment. I am following this tutorial to implement a fragment. Everything is fine with this tutorial, I successfully get the result like below: In the tutorial, the DetailsFragment simply shows a TextView containing the text of the currently selected item. That's the right part shows just some texts. My question is how to show different activities on the right side instead of text views. What I mean is illustrated in the following image, for example, the

Should I pass info using intent or use a static variables

*爱你&永不变心* 提交于 2020-02-02 09:25:12
问题 Another design question for you If I have 5 activities that can result from one activity A->B A->C A->E .... Etc And activity A has values that need to be passed to all other activites, then do you recommned passing them through intent or should I just have a global static variables in activity A and read the values in any other activity? Thank you 回答1: Definitely don't use static public variables. You should use: SharedPreferences or DB for data that should be persisted (cached) Intent

Should I pass info using intent or use a static variables

你说的曾经没有我的故事 提交于 2020-02-02 09:22:28
问题 Another design question for you If I have 5 activities that can result from one activity A->B A->C A->E .... Etc And activity A has values that need to be passed to all other activites, then do you recommned passing them through intent or should I just have a global static variables in activity A and read the values in any other activity? Thank you 回答1: Definitely don't use static public variables. You should use: SharedPreferences or DB for data that should be persisted (cached) Intent