프로그래밍 방식으로 Android에서 splitView를 만들려고합니다. 이 기능은 완전히 새로운 것입니다. 몇 가지 조사를 한 후에, 나는 조각이 사용되어야한다는 것을 깨달았다.은 splitView를 프로그래밍 방식으로 구현합니다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment android:name="com.example.news.ArticleListFragment"
android:id="@+id/list"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent" />
<fragment android:name="com.example.news.ArticleReaderFragment"
android:id="@+id/viewer"
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="match_parent" />
</LinearLayout>
LinearLayout이 레이아웃에 가장 적합한 옵션입니까? 두 번째로 단추, 피커 같은 UI 파트를 프로그램 적으로 추가 할 수 있습니까?
어떤 도움을 주셔서 감사합니다. 예가 더 좋을 수도 있습니다. 감사.
덕분에 Rajdeep, 당신은 예를 제공 할 수주십시오? 감사. – user788511
예제를 표시 할 응답을 수정했습니다 –
Rajdeep 감사합니다. 그러나 Fragment에보기를 추가하는 것이 좋습니다. 귀하의 예제는 레이아웃에보기를 추가하는 것 같습니다. 제발 조언. – user788511