I created a custom class from an online tutorial. It works fine, but I want to make it so that I can set the text of the view, like any other view. How it's done. Here is the xml for custom view
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<ImageView
android:id="@+id/file_image_holder"
android:layout_width="110dip"
android:layout_height="110dip"
android:src="@drawable/pdf_icon" />
<TextView
android:id="@+id/file_name_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="File Name Here" />
</LinearLayout>
What I'm trying to achieve is
FileView fileView = new FileView(this)
fileView.setText("text")
source
share