android-layout

Adding views programmatically to LinearLayout but they don't appear

爷,独闯天下 提交于 2020-03-23 07:50:32
问题 I'm trying to populate a LinearLayout inside simple_pdf_example.xml with 10 printed_order_element2.xml just so I can generate a PDF with a ListView (which is actually a LinearLayout ). The problem is that when I do linearLayoutView.addView(v) 10 times, I don't see v inside the LinearLayout . I just see the original item I added in the xml just to see if the LinearLayout was rendering. SimplePDFSaver.java: package com.mypackage.example; import androidx.appcompat.app.AppCompatActivity; import

How can I remove white screen which appear before splash screen?

独自空忆成欢 提交于 2020-03-19 03:30:09
问题 While opening java file I first look blank white screen, and after that it appears me splash screen layout. I have java file as: new Handler().postDelayed(new Runnable() { @Override public void run() { //Task finish(); } }, ARG_SPLASH_TIME); And in xml file I simply put ImageView and set android:src value. In manifest file I open Splash activity in Launcher Mode. 回答1: Finally got my answer Splash Screen in Right Way . I do just following. In values->styles.xml I created splash screen

How to get a value of color attribute programmatically

馋奶兔 提交于 2020-03-18 05:21:06
问题 When I use resolveAttribute() to find out a color value of ?attr/colorControlNormal , I got 236 : TypedValue typedValue = new TypedValue(); getTheme().resolveAttribute(R.attr.colorControlNormal, typedValue, true); int color = typedValue.data; // 236 But when I use an XML layout with the following TextView element: <TextView android:id="@+id/textView" style="?android:attr/textAppearance" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="?attr

How to get a value of color attribute programmatically

痞子三分冷 提交于 2020-03-18 05:20:29
问题 When I use resolveAttribute() to find out a color value of ?attr/colorControlNormal , I got 236 : TypedValue typedValue = new TypedValue(); getTheme().resolveAttribute(R.attr.colorControlNormal, typedValue, true); int color = typedValue.data; // 236 But when I use an XML layout with the following TextView element: <TextView android:id="@+id/textView" style="?android:attr/textAppearance" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="?attr

How to get a value of color attribute programmatically

爱⌒轻易说出口 提交于 2020-03-18 05:20:03
问题 When I use resolveAttribute() to find out a color value of ?attr/colorControlNormal , I got 236 : TypedValue typedValue = new TypedValue(); getTheme().resolveAttribute(R.attr.colorControlNormal, typedValue, true); int color = typedValue.data; // 236 But when I use an XML layout with the following TextView element: <TextView android:id="@+id/textView" style="?android:attr/textAppearance" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="?attr

Grid view item not hightlight when press

隐身守侯 提交于 2020-03-17 11:31:52
问题 My app has a grid view, By default, Its item does not highlight when I click on it (I don't know why? ). I try to add it a list selector as below, But it does not work too, <GridView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_above="@+id/load_more_process_id" android:layout_alignParentTop="true" android:drawSelectorOnTop="false" android:listSelector="@drawable/grid_selector" > </GridView> Here my selector: <selector

Android: how to make a view grow to fill available space?

北战南征 提交于 2020-03-17 03:58:02
问题 This seems straightforward, but I can't figure out how to do it. I have a horizontal layout with an EditText and two ImageButtons. I want the ImageButtons to be of a fixed size, and the EditText to take up the remaining space in the layout. How can this be accomplished? <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content"> </EditText>

Android: how to make a view grow to fill available space?

喜夏-厌秋 提交于 2020-03-17 03:57:09
问题 This seems straightforward, but I can't figure out how to do it. I have a horizontal layout with an EditText and two ImageButtons. I want the ImageButtons to be of a fixed size, and the EditText to take up the remaining space in the layout. How can this be accomplished? <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content"> </EditText>

Bottom Navigation with fab

纵饮孤独 提交于 2020-03-13 04:32:25
问题 I am currently working with BottomNavigationView and FloatingActionButton . What i want to achieve is this below design: And what i have tried: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_insetEdge="bottom"

Bottom Navigation with fab

自作多情 提交于 2020-03-13 04:32:18
问题 I am currently working with BottomNavigationView and FloatingActionButton . What i want to achieve is this below design: And what i have tried: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_insetEdge="bottom"