我正在打开一个对话框,其中有两个选项按钮,当我选择任何一个时,下面的布局应该更改是屏幕截图
现在有下面的 list.xml 文件,其中有两个线性布局
英语(这是英语-泰卢固语列表)首先显示英语单词然后显示泰卢固语单词
<LinearLayout
android:id="@+id/engRowOfList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:orientation="vertical" >
<TextView
android:id="@+id/txtEng"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:textColor="#000000"
android:textSize="22dip"
android:textStyle="bold" />
<com....TextView
android:id="@+id/txtGuj"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:textColor="@color/orange"
android:textSize="22dip"
android:textStyle="bold"
lht:ttf_name="fonts/telugu.ttf" />
</LinearLayout>
泰卢固语(首先显示泰卢固语单词,然后显示英文单词
<LinearLayout
android:id="@+id/teluguRowOfList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:orientation="vertical" >
<com......GujTextView
android:id="@+id/txtEng"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:textColor="#000000"
android:textSize="22dip"
android:textStyle="bold"
lht:ttf_name="fonts/telugu.ttf" />
<TextView
android:id="@+id/txtGuj"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:textColor="@color/orange"
android:textSize="22dip"
android:textStyle="bold" />
</LinearLayout>
正如许多人建议的那样,你可以通过 LinearLayout.GONE/LinearLayout.VISIBLE 来做,所以我在下面的代码中尝试过,但仍然无法做到下面是我的代码
scAdapter = new SimpleCursorAdapter(getApplicationContext(),
R.layout.list, cursor, new String[] { Const.ENGLISH,
Const.TELUGU }, new int[] { R.id.txtEng,
R.id.txtTelugu });
scAdapter.setViewBinder(new ViewBinder() {
public boolean setViewValue(View view,
android.database.Cursor cursor, int columnIndex) {
engListView = (LinearLayout) view.findViewById(R.id.engList);
teluguListView = (LinearLayout) view.findViewById(R.id.teluguList);
if (flagEnFl) { //flag for ENGLISH / TELUGU
engListView.setVisibility(LinearLayout.GONE); ***//HERE I AM GETTING NULLPOINTEREXCEPTION EVERY TIME***
teluguListView.setVisibility(LinearLayout.VISIBLE);
} else {
engListView.setVisibility(LinearLayout.VISIBLE);
teluguListView.setVisibility(LinearLayout.GONE);
}
任何人都可以帮助我如何处理这种情况