What does the ? in Android XML mean [duplicate] - android

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Question mark (?) in XML attributes for Android
<TextView android:id="#+android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
what does "?android:attr/textAppearanceLarge" do? Does it have a name? Why doesn't it use an "#" instead? Can I use this syntax in my own code? Where can I read more about this? Since I don't know what it is, it's kind of hard to find more information about it. Any guidance would be greatly appreciated.

This question has already been asked on stackoverflow.
The answer given was:
The question mark means it's a reference to a resource value in the
currently applied theme.
Look here for more details.

It is a reference to style attribute. Check this reference:
References To Theme Attributes

Related

String type not allowed (at textColor with value 'black'): Android Studios [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I am fairly new to using android studios.
the below error cropped up while trying to adjust the color
try this
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/colorAccent"/>
or this
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#ff00"/>
or this
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/black"/>
You need to use #android:color/black or provide a hexadecimal color code value

How to set src of ImageView to android yellow (pressed) star [duplicate]

This question already has answers here:
How can I use a system provided icon in Android (e.g. expander_ic_maximized)
(3 answers)
Closed 8 years ago.
Attempt 1:
<ImageView
android:id="#+id/star_contact"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:padding="5dp"
android:src="#android:drawable/btn_star_big_off"/>
But it is showing a white hollow star instead of yellow star.
Attempt 2:
<ImageView
android:id="#+id/star_contact"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:padding="5dp"
android:src="#android:drawable/btn_star_big_off_pressed"
visibility="gone"/>
But I am getting this error:
resource is not public at src with value '#android:drawable/btn_star_big_off_pressed'
Is there a way to fix my 2nd attempt's error?
Is there a way to initially set android resource star image to be pressed?
I appreciate help and willing to tick a correct answer.
In general, it's better to copy drawables from Android and use them, rather than directly use the Android drawables. Take a look at the downloadables from Android SDK. Take a look at this question for how to access them as well.
It used to be the advice on the Android Design documents to always do things this way, but that advice seems to be removed. Still, if you're having problems, you can always try this.
You are looking at this drawable
android.R.drawable.btn_star_big_on
This post here has a corresponding icon along with the drawables available in android.R package. So in your case it will be
android:src="#android:drawable/btn_star_big_on"
I did a test in my device with this imageview
<ImageView
android:id="#+id/star_contact"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:padding="5dp"
android:src="#android:drawable/btn_star_big_on"/>
It is showing yellow like this:
Here is the list of drawable that are accessible
If it's not in the list, then you have to add drawables in your project and access from there.

How to handle click events on a drawable within an TextView? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have the same problem as discussed on Handling click events on a drawable within an EditText, but I use TextView instead of EditText. When I click on the TextView, the method onTouchEvent(MotionEvent event) is called. Is it possible to handle a click only on the icon?
I think the idea is pretty much the same as described here: use the event coordinates and determine if they are within the drawable's bounds. If they are, perform your action. I don't think there are any major differences between TextView and EditText in this respect.
I think that it would be a better idea to use a TextView and an ImageView. Of course, it leads to a more complex layout structure, but I'd prefer two widgets in an XML file rather than too much Java code dealing with the widgets.
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/iv"
android:text="#string/long_text"
android:textSize="22sp" />
<ImageView
android:id="#id/iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:contentDescription="#string/app_name"
android:src="#drawable/btn_go" />

Making not editable EditText component [duplicate]

This question already has answers here:
Can we have uneditable text in edittext
(2 answers)
Closed 10 years ago.
I have an edit text. How can I make it non editable from the code.
By giving the tag android:editable we can do in the layout.. But I need to do it in the code...Pls Help
I believe it is as simple as
editText.setEnabled(false);
Refer EDITTEXT
edt.setClickable(false);
edt.setFocusable(false);
***Layout***
<EditText android:id="#+id/edt"
android:layout_width="200px" android:layout_height="wrap_content"
android:text="" android:textSize="18sp" android:maxLength="15">
</EditText>
If you didnt find yet an answer, i have found this in the net:
http://code.google.com/p/android/issues/detail?id=2854
I am using for this problem, this solution:
valueText.setEnabled(false);
valueText.setClickable(false);
valueText.setFocusable(false);
//Just for better text vision
valueText.setTextColor(Color.WHITE);

Justify Text in TextView Android [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How do you get textview to be justified ? is it possible to get the solution? I have searched most of the forums but i didn't make it up. please help me out.
UPDATED
We have created a simple class for this. There are currently two methods to achieve what you are looking for. Both require NO WEBVIEW and SUPPORTS SPANNABLES.
LIBRARY: https://github.com/bluejamesbond/TextJustify-Android
SUPPORTS: Android 2.0 to 5.X
SETUP
// Please visit Github for latest setup instructions.
SCREENSHOT
Android doesn't support text justification, sorry. You can use android:gravity attribute to align text to left or right or center etc, but you can't really justify it. The only option I guess is to use a WebView to show text and then use CSS to get the text justified.
<RelativeLayout android:id="#+id/RelativeLayout01"
android:layout_height="wrap_content" android:layout_width="fill_parent">
<TextView android:id="#+id/TextView2" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="I'm TextView- Left" android:layout_alignParentLeft="true">
</TextView>
<TextView android:id="#+id/TextView1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="I'm TextView- Right" android:layout_alignParentRight="true">
</TextView>
</RelativeLayout>
ScreenShot:
Hope this helps. If you have any difficulties write back.- Thanks

Categories

Resources