I am new to android.
I use Android Studio 1.0. I'm trying to do custom layoutfor listView. I created custom layout files in res/layout named row_layout. xml for layout:
Android Studio 1.0
custom layout
listView
res/layout named row_layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/cl_textView" android:textSize="30sp" android:textStyle="bold" android:padding="15dp"/> </LinearLayout>
Code for implementing this custom layout in the MainActivity class:
ListAdapter theAdapter = new ArrayAdapter<String>(this, android.R.layout.row_layout,toDoList);
But the activity class does not detect this custom layout and shows an error below when creating.
R.layout , . , (drawable, string, layout ..), , R.
R.layout
R
R.layout.*, r.drawable.*, R.id.*, R.color.* etc
android.R SDK Android. , , SDK Android, , android.R
android.R
, android.R.layout R.layout
android.R.layout
android.R. R., R.* , android.R.* , Android SDK. (R.* your.package.R.*)
android.R.
R.
R.*
android.R.*
your.package.R.*
, .
:
ListAdapter theAdapter = new ArrayAdapter<String>(this, R.layout.row_layout,toDoList);
android.R refers to those resources previously built into the sroid sroid.
Since you have defined your own layout for representing a custom list, you must use the R file generated in your project.
Source: https://habr.com/ru/post/1569110/More articles:Codeigniter Active Record selects only the first record, not the most recent - phpHow can I read from a specific raw file descriptor in Rust? - unixGroceryCRUD: how to set dropdown list box - phpExtract node from xml - xmlWPF: default value for converter before setting DataContext - c #Как вы правильно размещаете AWS с помощью эластичного beanstalk и Dockerrun.aws.json? - dockerHow to use Intel AVX in Java? - javaWithout any arguments - c ++Score in GHCi 7.8.3 - haskellCan you name the scripts as steps in Behat 3? - phpAll Articles