Category : xml

I have been often told to use 0dp on views while using weight in XML like this : <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button android:id="@+id/a1" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" android:text="1" /> </LinearLayout> but there is a problem with this code which is when i use a view like Button, i can’t force it to take the exact ..

Read more

I create Drawable resource file to change button background. My problem is when I add this file to my button xml code , it hasn’t changed and retains its default shape (purple background) and this happens only for its background. Drawable resource file (circle_mode_button): <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <gradient android:startColor="#827F9B" android:endColor="#E1E0E7"android:angle="-45"/> ..

Read more

So basically I made one minute countdown in Android Studio using java. As soon as timer riches "0", I want to change activities and reset timer. so that when I visit this activity again, timer would work. Here’s my java code: public class BeginAfter extends AppCompatActivity { TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { ..

Read more

I started a new project and want to do things right so I’ve read upon how to make reusable styles and apply themes to my project: I’ve done it in a way that i split my themes and my styles: attr.xml: <attr name="buttonCornerRadius" format="dimension" /> <attr name="buttonBackgroundColor" format="color" /> <attr name="buttonStrokeWidth" format="dimension" /> <attr name="buttonStrokeColor" ..

Read more

I started a new project and want to do things right so I’ve read upon how to make reusable styles and apply themes to my project: I’ve done it in a way that i split my themes and my styles: attr.xml: <attr name="buttonCornerRadius" format="dimension" /> <attr name="buttonBackgroundColor" format="color" /> <attr name="buttonStrokeWidth" format="dimension" /> <attr name="buttonStrokeColor" ..

Read more