0
에 사용되는 기본 환경 설정 높이 나는 사용자 정의 기본 설정이 있습니다안드로이드 사용자 환경
public class ButtonPreference extends Preference {
public ButtonPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public ButtonPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected View onCreateView(ViewGroup parent) {
super.onCreateView(parent);
LayoutInflater li = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
return li.inflate(R.layout.button_prederence, parent, false);
}
}
및 XMLbutton_prederence.xml
:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click me" />
</LinearLayout>
, 그래서 기본 환경 설정 높이를 받아서 ButtonPreference
에 적용해야합니다.
어떻게하면됩니까?