저도 구글링으로도 해법을 못구하다가


어떤 글을 읽고 혹시해서 사용중인 프로그램 전부 종료하고


메모리확보 한 후

빌드쳤는데 잘 되네요!!!



만약 이걸로 고생하시는 분들에게 도움이 되었으면 좋겠어요 .. ㅎㅎㅎㅎㅎㅎㅎ











1
int drawableResourceId = this.getResources().getIdentifier("nameOfDrawable""drawable"this.getPackageName());
cs



I warn you, this way of obtaining identifiers is really slow, use only where needed.



https://stackoverflow.com/questions/3476430/how-to-get-a-resource-id-with-a-known-resource-name

https://stackoverflow.com/questions/3476430/how-to-get-a-resource-id-with-a-known-resource-name

https://stackoverflow.com/questions/3476430/how-to-get-a-resource-id-with-a-known-resource-name










fragment는


현재 유저의 보고있는 화면단?을 알려주는


setUserVisibleHint라는 아주 좋은 메서드를 가지고 있지요 ..


근데 앱 실행시에 이게 onCreateView보다 먼저 호출 될 때가 있어서


사용자들에게 큰 혼란을 야기할 수 있습니다



그래서 아주 좋은 해결책 !





1
2
3
4
5
6
7
8
9
10
11
12
13
14
// create boolean for fetching data
private boolean isViewShown = false;
 
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
    super.setUserVisibleHint(isVisibleToUser);
    if (getView() != null) {
        isViewShown = true;
        // fetchdata() contains logic to show data when page is selected mostly asynctask to fill the data
        fetchData();
    } else {
        isViewShown = false;
    }
cs





https://stackoverflow.com/questions/24161160/setuservisiblehint-called-before-oncreateview-in-fragment

https://stackoverflow.com/questions/24161160/setuservisiblehint-called-before-oncreateview-in-fragment

https://stackoverflow.com/questions/24161160/setuservisiblehint-called-before-oncreateview-in-fragment







1
2
3
4
5
6
7
8
9
10
11
// you need to have a list of data that you want the spinner to display
List<String> spinnerArray =  new ArrayList<String>();
spinnerArray.add("item1");
spinnerArray.add("item2");
 
ArrayAdapter<String> adapter = new ArrayAdapter<String>(
    this, android.R.layout.simple_spinner_item, spinnerArray);
 
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner sItems = (Spinner) findViewById(R.id.spinner1);
sItems.setAdapter(adapter);

cs



https://stackoverflow.com/questions/11920754/android-fill-spinner-from-java-code-programmatically

https://stackoverflow.com/questions/11920754/android-fill-spinner-from-java-code-programmatically

https://stackoverflow.com/questions/11920754/android-fill-spinner-from-java-code-programmatically


















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


+ Recent posts