RelativeLayout --If you use toEndOf etc. in RelativeLayout, It can be side by side even if it is not LinearLayout. --Center Horizontal (true) of RlativeLayout can be used for centering.
EditText
--If you want to enter characters in the placeholder, use hint.
hoge.xml
<EditText
android:id="@+id/login"
android:layout_width="200dp"
android:layout_height="40dp"
android:hint="@string/login"
android:textColor="@color/white"
android:textColorHint="@color/clear_white" />
--If center_vertical does not work, set layout_gravity to center.
--When you want to place two same views side by side: set layout_weight: 1 and set Width = 0. --When you want to place two same views vertically: set layout_weight: 1 and set Height = 0.
--Use ViewPager / PagerTitleStrip.
--Set gravity = center.
--Create shape.xml separately in drawable and refer to it in the background of view.
shape.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!--Border width:Line width, color:Line color-->
<stroke
android:width="0.6dp"
android:color="@color/white" />
</shape>
--Create a selector in hoge.xml of drawable and refer to it with textColor.
hoge.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:s="true" android:state_pressed="false" android:color="@color/black" />
<item android:state_focused="true" android:state_pressed="true" android:color="@color/black" />
<item android:state_focused="false" android:state_pressed="true" android:color="@color/black" />
<item android:color="@color/white" />
</selector>
--Create a selector in huga.xml of drwable and refer to it in src.
huga.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!--Pressed state-->
<item
android:state_pressed="true"
android:drawable="@drawable/setting_click" />
<!--Normal state-->
<item
android:drawable="@drawable/setting" />
</selector>
Recommended Posts