How do you create a 'read more' layout in Android? - android

I want to display a 'read more' link when the obtained text increases to a certain limit, so that if user wants to read in detail, they can click on read more just like the Application installation page of Play Store
Please suggest me on how to implement this

You can refer this. Layout available on git hub
https://github.com/traex/ExpandableLayout

Thank you all for giving answer, here is how i solved it.
There is a property called android:maxLines=""
using this property we can add Read More text view below the text view by making it clickable so that when user clicks on the text view we can perform any action we wanted
Example:
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Device supports NFS etc....."
android:maxLines="4"
android:id="#+id/description" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Read More"
android:layout_gravity="center_horizontal"
android:textColor="#0066FF"
android:id="#+id/readmore" />
I hope this helps.

Look like on google play this link opens other activity. So, it is just button with startActivity() behavior.

Related

I want to use Service for Phone number

See the view here
I want to do this only, like when someone click on a number format, then my app should also be visible in the OPEN WITH list...
Add android:autoLink="phone" into the TextView.
For example:
<TextView
android:id="#+id/tvMsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:autoLink="phone"
android:textColorLink="#color/purple_500"/>
For more info please check these questions: Question1 and Question2

How to make a android textview autolink its value as a phone number

So Ive currently made a working app that when the user puts in an employees name and searches it searches my sql database and returns with a name, phone number, id and address all in a list so that each result is kinda separated from the next. Im trying to make the phone number auto link as a phone number so that the user can click on it and it will call it but Im unsure of how to do this. Yes I have followed and looked at the other tutorials for that on this site and haven't been able to make it work. hoping you guys can help me out. For starters, yes I have added the permission to the manifest.
Here is the xml layout for the textview I wish to make clickable
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Phone Number"
android:id="#+id/textType"
android:layout_marginLeft="5dp"
android:layout_below="#id/textSize"
android:textColor="#666"
android:clickable="true" />
And here the java that setups up how the number will be displayed. Not sure if this is needed or even helps.
myHolder.textType.setText("Mobile Phone# " + current.Phonenum);
Try adding the android:autoLink="phone" attribute, so your code should look like this:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="123 456 7890"
android:id="#+id/textType"
android:layout_marginLeft="5dp"
android:layout_below="#id/textSize"
android:autoLink="phone"
android:textColor="#666"
android:clickable="true"
/>
On the TextView in the xml add:
android:inputType="phone"

How can enable the "Copy-paste" menu in EditText?

I worked with editText in Android, but when i want select,copy or paste text/number inside of ediTText it's impossible,that is to say, if I pressing (Long press) don't show the menu to select "paste" or anything.
The code from my xml file (EditText) is the next:
<com.rengwuxian.materialedittext.MaterialEditText
android:id="#+id/titulo_articulo_periodico"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:maxLines="1"
android:inputType="text"
android:singleLine="true"
android:textIsSelectable="true"
android:hint="#string/periodico_hint1"
android:textColor="#color/text_color"
app:met_primaryColor="#color/refresco"
app:met_clearButton="true"/>
I work with "Material EditText" library (github: https://github.com/rengwuxian/MaterialEditText) but I don't see difference between my code and the owner code, my friend tell me than i need use onActionItemClicked in every editText, but with this code my Java code is too long. I don't know what do, I'm tired. :(
I think there is no short way of doing it. You have to use Clipboard Manager, And have a lengthy way of implementing the functionality. I am still looking for a simple solution to this. until then refer this link
https://developer.android.com/guide/topics/text/copy-paste.html

Simple non interactive ListView Android

Please cope with me as im new to android and i have done a lot of searching on my own, about this, and im fed up not finding a proper way.
This is my custom listview template. rowbuttonlayout.xml.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#+id/label"
android:textSize="19.6dp" >
</TextView>
<CheckBox
android:id="#+id/check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="3.6dp"
android:layout_marginRight="9.6dp" >
</CheckBox>
<TextView
android:id="#+id/result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/check"
android:layout_alignBottom="#+id/check"
android:layout_toLeftOf="#+id/check"
android:text="#string/nothing" />
</RelativeLayout>
What i want is to create something like this in this pic without the header and footer.
http://www.vogella.com/articles/AndroidListView/images/xinteractive10.png.pagespeed.ic.V0cVgp99SN.png
As on my layout ill be having another textview just before the checkbox as well. Also ill be adding a dynamic button at the footer.
Now i dont want the users to interact with my listview. Only the button should be clickable and when they click it i want to run some calculations and show them in the relevant "result" textview and to check the checkbox next to it to show that i have calculated it. Meaning i have to access each and every "result" textview and "check" checkbox in the code.
Please provide me some guidance for coding this app. Im fed up looking through very complex codes trying learn on my own. Many many thanks for your help.
Shavinka
Check out below links...
ListView + CheckBox =?
How to get checked items from android listview?
http://sunil-android.blogspot.in/2013/04/android-listview-checkbox-example.html
http://fundoocode.net/android-listview-checkbox-example-onitemclicklistener-and-onclicklistener/
http://www.mysamplecode.com/2012/07/android-listview-checkbox-example.html

Is there a view for a button bar? (Image link describing the view)

I am looking for a view or some sort of information regarding the bottom bar in default applications of Android such as Email, or Unlock pattern as shown in the picture below. I have not been able find anything about this on Androids site nor from Google searches.
Image: http://img11.imageshack.us/i/viewdn.jpg/
I believe that Christopher is correct; there is no special widget to create the bar in your image. However, if you want to emulate it, you can create a layout and use the style style="#android:style/ButtonBar". That will give you the light gray background and the correct margins.
I don't believe there's any standard view for the button bar used at the bottom of these apps; it's generally just two Button items placed together in a LinearLayout or RelativeLayout.
For example, looking at the Android Open Source Project, you can see the button bar for one of the email app setup screens is defined as two plain old Button objects.
However, it is surprising that Google didn't abstract more of the common stuff into an Android theme or sublayout, rather than having the same views and attributes in each layout XML.
From: http://code.google.com/p/k9mail/source/browse/k9mail/trunk/res/layout/account_setup_basics.xml?r=1314
<RelativeLayout
android:layout_marginTop="-45dip"
android:padding="0dip"
android:layout_alignParentBottom="true"
android:gravity="bottom|right"
android:background="#android:drawable/bottom_bar"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<Button
android:id="#+id/manual_setup"
android:text="#string/account_setup_basics_manual_setup_action"
android:minWidth="#dimen/button_minWidth"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginBottom="-4dip"
android:layout_alignParentLeft="true"
android:layout_centerVertical="false"
/>
<Button
android:id="#+id/next"
android:text="#string/next_action"
android:minWidth="#dimen/button_minWidth"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:drawableRight="#drawable/button_indicator_next"
android:layout_marginBottom="-4dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="false"
/>
</RelativeLayout>

Categories

Resources