DialogFragment를 아랫부분에 타이트하게 붙이고싶었는데



DialogFragment에서 기본 padding 값이 있어서 붙이지 못했다




검색을 오래 해도 해법이 없었다 ...













근데 엉뚱하게 다른곳에서 해결책을 찾아서 약간 어이가 없는 상태!


1
2
3
4
5
Window window = getDialog().getWindow();
window.setGravity(Gravity.CENTER| Gravity.BOTTOM);
window.getAttributes().windowAnimations = R.style.DialogAnimation;
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
View view = inflater.inflate(R.layout.fragment_input_form,container,false);
cs












다른부분은 전부 stackoverflow 같은곳에서 확인 가능 했지만



window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));



이부분은 다른곳 만지다가 얼떨결에 알아냈다


이유는 정확하게 설명할 수 없다


Gravity 값에 따라 DialogFragment 위치를 변경 할 수 있으니 참고 바람 !! 














  1. Go to your "some_layout.xml"
  2. Click right -> Refactor -> Rename (or SHIFT + F6)
  3. Rename your layout to "some_layout2.xml" for example
  4. Rename this file back to the original "some_layout.xml"




https://stackoverflow.com/questions/34368329/data-binding-android-type-parameter-t-has-incompatible-upper-bounds-viewdata

https://stackoverflow.com/questions/34368329/data-binding-android-type-parameter-t-has-incompatible-upper-bounds-viewdata

https://stackoverflow.com/questions/34368329/data-binding-android-type-parameter-t-has-incompatible-upper-bounds-viewdata








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
 
    <item
        android:bottom="-5dp"
        android:right="-5dp"
        android:top="-5dp">
        <shape android:shape="rectangle" >
            <solid android:color="@color/color_of_the_background" />
 
            <stroke
                android:width="5dp"
                android:color="@color/color_of_the_border" />
        </shape>
    </item>
 
</layer-list>
cs






this way only left border is visible but you can achieve any combination you want by playing with bottomleftright and top attributes of the item element




https://stackoverflow.com/questions/9211208/how-to-draw-border-on-just-one-side-of-a-linear-layout

https://stackoverflow.com/questions/9211208/how-to-draw-border-on-just-one-side-of-a-linear-layout

https://stackoverflow.com/questions/9211208/how-to-draw-border-on-just-one-side-of-a-linear-layout







Go to File > Sync Project with Gradles Files.



https://stackoverflow.com/questions/47289011/how-can-i-fix-design-editor-is-unavailable-until-a-successful-build-error

https://stackoverflow.com/questions/47289011/how-can-i-fix-design-editor-is-unavailable-until-a-successful-build-error

https://stackoverflow.com/questions/47289011/how-can-i-fix-design-editor-is-unavailable-until-a-successful-build-error




The xml would go like this :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
<LinearLayout
    android:id="@+id/headerLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
 
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="@drawable/headerImage"
        android:orientation="vertical" />
 
    <View
        android:layout_width="fill_parent"
        android:layout_height="5dip"
        android:background="@drawable/drop_shadow" >
    </View>
</LinearLayout>
...
cs



drop_shadow.xml :


1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">    
    <gradient
        android:startColor="#404040"
        android:endColor="#F1F1F1"
        android:angle="270"
        >
    </gradient>
</shape>
cs



https://stackoverflow.com/questions/14463747/simple-layout-shadow-in-android

https://stackoverflow.com/questions/14463747/simple-layout-shadow-in-android

https://stackoverflow.com/questions/14463747/simple-layout-shadow-in-android

If anyone reading this has the same problem, this happened to me recently, and it was due to having the xml header written twice by mistake:



1
2
3
4
5
6
7
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?> <!-- Remove this one -->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
     <solid android:color="@color/mug_blue"/>
     <corners android:radius="@dimen/featured_radius" />
</shape>
 
cs



The error I was getting was completely unrelated to this file so it was a tough one to find. Just make sure all your new xml files don't have some kind of mistake like this (as it doesn't show up as an error). EDIT It seems like it shows up as an error now, make sure to check your error logs.




실수로 xml 태그 두번 적었을때 발생 가능



https://stackoverflow.com/questions/48549587/failed-linking-file-resource-i-am-getting-this-error-even-after-trying-all-po?rq=1

https://stackoverflow.com/questions/48549587/failed-linking-file-resource-i-am-getting-this-error-even-after-trying-all-po?rq=1

https://stackoverflow.com/questions/48549587/failed-linking-file-resource-i-am-getting-this-error-even-after-trying-all-po?rq=1








gradle.properties에


1
2
3
android.useAndroidX=true
android.enableJetifier=true
 
cs



값 추가 후 gradle sync



https://stackoverflow.com/questions/52497475/android-studio-adds-both-androidx-annotation-and-android-support-annotation-nu

https://stackoverflow.com/questions/52497475/android-studio-adds-both-androidx-annotation-and-android-support-annotation-nu

https://stackoverflow.com/questions/52497475/android-studio-adds-both-androidx-annotation-and-android-support-annotation-nu










http://ktko.tistory.com/entry/Target-runtime-Apache-Tomcat-is-not-defined-%ED%95%B4%EA%B2%B0-%EB%B0%A9%EB%B2%95

http://ktko.tistory.com/entry/Target-runtime-Apache-Tomcat-is-not-defined-%ED%95%B4%EA%B2%B0-%EB%B0%A9%EB%B2%95

http://ktko.tistory.com/entry/Target-runtime-Apache-Tomcat-is-not-defined-%ED%95%B4%EA%B2%B0-%EB%B0%A9%EB%B2%95

+ Recent posts