开发者

A few random android development questions

开发者 https://www.devze.com 2023-01-29 18:23 出处:网络
Hey everyone, I didn\'t want to make separate topics so I decided to put all my questions into 1 topic. It\'s okay if you can\'t answer them all at once but it would be helpful if you could answer eve

Hey everyone, I didn't want to make separate topics so I decided to put all my questions into 1 topic. It's okay if you can't answer them all at once but it would be helpful if you could answer even one of them.

1.) In my table layout I have 3 buttons horizontally next to each other. Only half of the 3rd button shows. Shouldn't eclipse automatically re-size all three to make them fit whatever screen is viewing the app? Is there a way to automatically re-size them to fit each screen? --The ScrollView, TableLayout, and Buttons all have height and width set to wrap_content

2.) Is there a way to make links change color when you click them? Sort of like 'A:visited' or 'A:hover' in CSS. Because right now, I have [code]android:autoLink="web"[/code] in one of my XML files. The link is blue, but it is rather annoying not knowing if you clicked it or not until a popup appears. I开发者_运维问答'm sure there is some javascript that I can use however I would like for it to return back to a normal color once the user hits the back button... that way if they want to click it again it will still change colors.

3.) How do you embed a link inside an ImageView?

4.) If I use a LinearLayout and orientation set to Vertical with a background image, there is a black space on the right side and the very bottom of the screen. The image doesn't fill that part up. How can I get it to fill up?


1.) Why should anything be resized based on the screen if it's set to wrap_content? Also, eclipse doesn't do anything, it's just an IDE.


Answers: 1. it can be easily accomplished using combinations of linearlayouts(Vertical/horizontal orientations) and setting android:layout_weight attribute 3. Try using Framelayout or Relativelayout for showing Imageview and above it set your textview containing link. Something like this :

<RelativeLayout 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" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/android_4" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/imageView1"         
        android:text="Medium Text"
        android:gravity="center"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    </RelativeLayout>

Unable to understand your question 4 can you please elaborate more.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号