android-layout

Android: LinearLayout addView Animation

一笑奈何 提交于 2020-12-27 08:55:41
问题 I currently have a working Android program that programmatically adds views to a LinearLayout. I would like those views to be animated in and cannot find any good resources on figuring out how to do this. Could someone point me in the right direction? 回答1: It's a very old question, but still interesting: you can use the attribute android:animateLayoutChanges="true" For example: <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap

Android: LinearLayout addView Animation

雨燕双飞 提交于 2020-12-27 08:55:02
问题 I currently have a working Android program that programmatically adds views to a LinearLayout. I would like those views to be animated in and cannot find any good resources on figuring out how to do this. Could someone point me in the right direction? 回答1: It's a very old question, but still interesting: you can use the attribute android:animateLayoutChanges="true" For example: <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap

How can I add a shadow to bottom sheet view?

▼魔方 西西 提交于 2020-12-27 08:24:25
问题 As of now, with the official bottom sheet component from the Android design library implemented the top edge doesn't show a shadow. But for what I've seen in various mockups and in the Material Design specs, the bottom sheet include a discrete shadow of some sort. I think the shadow would help distant the bottom sheet from the main layout, especially if there's a peek value set and/or the bottom sheet is always visible. Otherwise it just will blend together with the main layout and its items.

How can I add a shadow to bottom sheet view?

让人想犯罪 __ 提交于 2020-12-27 08:20:08
问题 As of now, with the official bottom sheet component from the Android design library implemented the top edge doesn't show a shadow. But for what I've seen in various mockups and in the Material Design specs, the bottom sheet include a discrete shadow of some sort. I think the shadow would help distant the bottom sheet from the main layout, especially if there's a peek value set and/or the bottom sheet is always visible. Otherwise it just will blend together with the main layout and its items.

How to set fullscreen in Android R?

喜你入骨 提交于 2020-12-24 23:56:12
问题 I need to put a screen in fullscreen in my app. For this I am using this code: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) requestWindowFeature(Window.FEATURE_NO_TITLE) window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN) setContentView(R.layout.activity_camera_photo) However, the WindowManager.LayoutParams.FLAG_FULLSCREEN flag is deprecated. My app supports Android Lollipop (API 21) to Android R

Android App on Chrome OS does not get the proper DisplayMetrics window height

社会主义新天地 提交于 2020-12-15 03:41:34
问题 I need to get the height of the available Android app's screen on a Chrome OS device. I am using DisplayMetrics to get the height dimension. However, displayMetrics.heightPixels does not get the full height of the app screen on Chrome OS devices. There is always a small gap on Chrome OS devices. This can be visualized using the WindowManager example I have provided below. Just copy and paste this into your main activity and run the app in a Chrome OS device (I used Google Pixel Slate) and

Using DiffUtil, How to prevent blocking the main thread when updating the recyclerView contained in a NestedScrollView?

久未见 提交于 2020-12-07 10:56:01
问题 I'm trying to udate my recyclerView in background Thread without any succes. Updating the recyclerView still block the main thread. Here my adapter: public class PostAdapter extends RecyclerView.Adapter<PostAdapter.PostViewHolder> { private List<PostItems> postList; private Context context; private Queue<List<PostItems>> pendingUpdates = new ArrayDeque<>(); PostAdapter(List<PostItems> postList, Context context) { this.postList = postList; this.context = context; } @NonNull @Override public

Using DiffUtil, How to prevent blocking the main thread when updating the recyclerView contained in a NestedScrollView?

穿精又带淫゛_ 提交于 2020-12-07 10:55:07
问题 I'm trying to udate my recyclerView in background Thread without any succes. Updating the recyclerView still block the main thread. Here my adapter: public class PostAdapter extends RecyclerView.Adapter<PostAdapter.PostViewHolder> { private List<PostItems> postList; private Context context; private Queue<List<PostItems>> pendingUpdates = new ArrayDeque<>(); PostAdapter(List<PostItems> postList, Context context) { this.postList = postList; this.context = context; } @NonNull @Override public

How to generate rounded square launcher icon android

主宰稳场 提交于 2020-11-30 12:41:09
问题 I try to generate new launcher icon for my android project. I am taking png icon 512x512 and through Android Studio I am converting it New->Image Asset->(Launcher Icons Adaptive and legacy). It generates icon, but the size of radius of rounded square is less than it was 7 month ago when I generated it for the first time. How can I make bigger radius for icon corners? Or it's new default icons for android? Thanks. 回答1: Using this you can generate the rounded icon for the launcher. https:/

RecyclerView adapter showing wrong images

自古美人都是妖i 提交于 2020-11-30 09:19:42
问题 I have a RecyclerView adapter that looks like this: public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.ViewHolder> { private static Context context; private List<Message> mDataset; public RecyclerAdapter(Context context, List<Message> myDataset) { this.context = context; this.mDataset = myDataset; } public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnCreateContextMenuListener, View.OnClickListener { public TextView title; public LinearLayout