Igor Soloydenko
Igor Soloydenko

Reputation: 11825

Do com.android.internal.R.attr and android.R.attr have the same set of values?

I need to use a built in value from Android resources. This value is stored com.android.internal.R.attr.listViewStyle. Being unable to get that from within my code, I tried to find the appropriate value I can use insted. Well, I've just found android.R.attr.listViewStyle.

Question 1: Are these values same?

Question 2: Where can I find the XML for com.android.internal.R.attr.listViewStyle? May be I have to create my own style instead that one. In order to find it out I should look at that file.

Sorry if these questions are silly. I'm new to Android development yet.

Upvotes: 2

Views: 3278

Answers (2)

hong4rc
hong4rc

Reputation: 4113

You can add listViewStyle in values/attr.xml with this code :

<attr name="listViewStyle" format="reference" />

Change com.android.internal.R.attr.listViewStyle in your code to R.attr.listViewStyle

I find it in this

Example for attr.xml

< ?xml version="1.0" encoding="utf-8"?>

< resources>

< attr name="listViewStyle" format="reference" />

</resources>

Upvotes: 1

nandeesh
nandeesh

Reputation: 24820

com.android.internal classes are internal to android, they are only accessible within frameworks.

I think com.android.internal.R.attr.listViewStyle and android.R.attr.listViewStyle are same.

If you want to create your own style you can check here . This contains two listViewStyle. They are used based on the device default theme(Light or dark).

If you want to use this style, then i think you dont need to specify anything in your code, this is default theme, so it is picked automatically, if no attributes are specified.

Upvotes: 5

Related Questions